| CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Tue, 23 Dec 2025 13:10:23 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20100214075402
location: https://web.archive.org/web/20100214075402/https://github.com/mojombo/primer
server-timing: captures_list;dur=0.557839, exclusion.robots;dur=0.037185, exclusion.robots.policy;dur=0.028759, esindex;dur=0.027287, cdx.remote;dur=10.092730, LoadShardBlock;dur=659.126506, PetaboxLoader3.datanode;dur=474.160533, PetaboxLoader3.resolve;dur=65.336146
x-app-server: wwwb-app210-dc8
x-ts: 302
x-tr: 698
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app210; path=/
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Tue, 23 Dec 2025 13:10:24 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.61
x-archive-orig-date: Sun, 14 Feb 2010 07:54:03 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "54f8e96edfefbf58657fd4f4e259122e"
x-archive-orig-x-runtime: 165ms
x-archive-orig-content-length: 23393
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sun, 14 Feb 2010 07:54:02 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: TLA-20100214062202-00695-00704-ia360920-20100214134402-00000-c/TLA-20100214071117-00799-ia360906.us.archive.org.warc.gz
server-timing: captures_list;dur=0.460457, exclusion.robots;dur=0.017697, exclusion.robots.policy;dur=0.008090, esindex;dur=0.010187, cdx.remote;dur=7.550346, LoadShardBlock;dur=128.872477, PetaboxLoader3.datanode;dur=80.297473, PetaboxLoader3.resolve;dur=353.383295, load_resource;dur=367.145560
x-app-server: wwwb-app210-dc8
x-ts: 200
x-tr: 561
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
mojombo's primer at master - GitHub
This service is courtesy of Pledgie.
mojombo / primer
- Source
- Commits
- Network (2)
- Issues (1)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
-
Branches (1)
- master ✓
- Tags (0)
Sending Request…
Enable Donations
Pledgie Donations
Once activated, we'll place the following badge in your repository's detail box:
Primer is a Flash-like API built on top of Canvas using jQuery. — Read more
primer /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Tue Oct 21 12:08:27 -0700 2008 | ignore DS_Store [mojombo] |
| |
README | Fri Oct 24 17:51:44 -0700 2008 | update readme with text info [mojombo] |
| |
primer.js | Sat Oct 25 09:58:34 -0700 2008 | implement removeChild() [mojombo] |
| |
test/ | Fri Oct 24 20:12:16 -0700 2008 | fix position relative bug and reset ext on clear [mojombo] |
README
##### ##### ### ## ## ##### #####
# # # # # ## ## # # # #
# # # # # ## ## # # #
#### #### # # # # # ### ####
# # # # # # # # # # #
# # # # # # # # # # #
### ### ## ### ### # ### ##### ### ##
Primer. By Tom Preston-Werner.
Primer is a Flash-like API layered on top of Canvas.
INSTALL
----------------------------------------------------------------------------
Just include jQuery and Primer libraries on your page.
<script src="jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="primer.js" type="text/javascript"></script>
BASIC DRAWING EXAMPLE
-----------------------------------------------------------------------------
In your html create an empty div with an id you can reference later:
<div id="primer"></div>
In your JavaScript, create a new Primer object for the div, specifying width
and height.
$(function() {
var primer = new Primer("#primer", 100, 100)
...
})
Now that you have a Primer instance, you can start adding layers to it. Start
by creating an instance of Primer.Layer:
var square = new Primer.Layer()
Now you can draw on the layer. Let's draw a 20x20 pixel gray square.
square.fillStyle = "#888888"
square.fillRect(0, 0, 20, 20)
The square won't be drawn until it is added to the Primer instance.
primer.addChild(square)
BASIC ANIMATION EXAMPLE
-----------------------------------------------------------------------------
If you follow the instructions in [Basic Drawing Example], you'll have an
object called `square` that has been drawn to the screen. Moving the square
to another place is as easy as setting its `x` and `y` values.
square.x = 10
square.y = 10
The square has now moved to its new location. Contrary to raw Canvas work,
Primer layers redraw themselves any time they're moved. If we'd like the
square to move slowly across the screen, we can simply increase the `x` value
on an interval.
function go() {
square.x += 1
}
setInterval(go, 100)
BASIC EVENTS EXAMPLE
-----------------------------------------------------------------------------
In Primer it's easy to attach event listeners to your Layers. Let's say we
want to log "in" and "out" when you mouse over and mouse out of your gray
square.
square.mouseover(function() {
console.log("in")
})
square.mouseout(function() {
console.log("out")
})
BASIC TEXT EXAMPLE
-----------------------------------------------------------------------------
Primer implements a basic version of Canvas' text api with standard DOM
elements since no major browser release yet offers this. Let's draw the text
"Hello, World!" in 12px Monaco in red at (0, 0) with a max width of 100px:
var text = Primer.Layer()
text.font = "12px Monaco"
text.fillStyle = "#FF0000"
text.textAlign = "center"
text.fillText("Hello, World!", 0, 0, 100)
The signature of fillText() is (text, x, y, width). The font attribute takes
standard CSS font values.
The text API currently does not support any transformations except
translation. 