paperJS (paper.js) JavaScript Library walk through by Brett Paufler - 12-3-13

JavaScript Tutorial & paper.js primer

Raster Animation

Picture Slide Show

Montana-006


PointText

Oddly, the most interesting (form a command word perspective) thing on this page was the PointText -- that and perhaps the 'Object Literal' method of contructing paperJS items.

First the PointText

            var MONTANA = new PointText({
                point: [pX, pY],
                content: "MONTANA",
                fillColor: "black",
                fontWeight: "bold",
                fontSize: fT,
                fontFamily: "Courier New"
            });
       
With pX, pY, & fT being derived thusly (so as to respond dynamically to the user's screen size).

// rename these paper properties to something more manageable
var w = view.size.width;
var h = view.size.height;

// resets w or h so picture fits screen (the smaller takes precedence)
if(w/h > vRatio){
    w = h * vRatio;
} else {
    h = w * hRatio;
}

// for PointText -- plug and chug formulas getting it to look 'right'
var pX = CP.x + w/8;
var pY = CP.y - w*3/8*hRatio;
var fT = w/16;

And that's about if for this project.
Now, I'm going to go back and edit down the pictures, rename them:
Clearly the naming scheme leaves something to be desired, but as this is the end of the road, polishing the code any further would be a waste of time (or so I believe, perhaps I shall change my mind in ten years when it no longer loads into a then modern browser).

A fully working spur with no extraneous dialog  may be found at MONTANA FINAL.  However, I can't say I'm overly pleased with the result.  After loading all the images, the lag time is simply too long.  Anyhow, it works, just not as desired.  (And with that said, I'm reducing the number of pictures on this page down to 5 of each type).

And with that, that's it for this particular project.
At this point, I couldn't say I know what's next.



previous -- Montana005        paper.js tutorial index       next - Back to Basics - Spirals-01



Back to BrettCode Home



Brett Words
my writing site (Home to the writing of Celli the Happy Go Lucky Celaphopod, Eddie Takosori, Fritz Heinmillerstein, Morgan Feldstone, Kevin Stillwater, and of course, me, your host, Brett Paufler)

paper.js official site = http://www.paperJS.org


© Copyright 2013 Brett Paufler