WebFontConfig = {
google: { families: [ 'Loved+by+the+King::latin' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
//$(".fancy_title p").lettering();
// get 2D context
var ctx = document.querySelector("canvas").getContext("2d"),
// dash-length for off-range
dashLen = 220,
// we'll update this, initialize
dashOffset = dashLen,
// some arbitrary speed
speed = 5,
// the text we will draw
txt = "enter the sunshine state",
// start position for x and iterator
x = 30, i = 0;
// Comic Sans?? Let's make it useful for something ;) w/ fallbacks
ctx.font = "50px Loved by the King";
// thickness of the line
ctx.lineWidth = 1;
// to avoid spikes we can join each line with a round joint
//ctx.lineJoin = "round";
// increase realism letting background (f.ex. paper) show through
ctx.globalAlpha = 2/3;
// some color, lets use a black pencil
ctx.strokeStyle = ctx.fillStyle = "#FFF";
(function loop() {
// clear canvas for each frame
ctx.clearRect(x, 0, 60, 150);
// calculate and set current line-dash for this char
ctx.setLineDash([dashLen - dashOffset, dashOffset - speed]);
// reduce length of off-dash
dashOffset -= speed;
// draw char to canvas with current dash-length
ctx.strokeText(txt[i], x, 90);
// char done? no, the loop
if (dashOffset > 0) requestAnimationFrame(loop);
else {
// ok, outline done, lets fill its interior before next
ctx.fillText(txt[i], x, 90);
// reset line-dash length
dashOffset = dashLen;
//...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.