pattern-example.js

total 0
used 0
limit 0
/* title: Using createPattern() files: ../point_src/core/head.js ../point_src/pointpen.js ../point_src/pointdraw.js ../point_src/math.js ../point_src/extras.js ../point_src/point-content.js ../point_src/pointlist.js ../point_src/pointlistpen.js ../point_src/point.js ../point_src/stage.js mouse dragging stroke --- Presenting the raw feature `ctx.createPattern()`, we can generate a "pattern" using an `OffscreenCanvas` and apply it as a fill. */ class MainStage extends Stage { canvas = 'playspace' mounted(){ this.offScreen = new OffscreenCanvas(50, 50) let oCtx = this.offScreen.getContext('2d') oCtx.fillStyle = '#010101'; //set fill color oCtx.fillRect(10, 10, 40, 40); Point.from(30,30, 10, 77).pen.indicator(oCtx, { width: 2}) this.pattern = this.ctx.createPattern(this.offScreen, 'repeat') this.point = new Point(10, 10) } draw(ctx){ this.clear(ctx) ctx.fillStyle = this.pattern; ctx.fillRect(0, 0, 300, 300); this.point.rotation += 1 this.point.pen.indicator(ctx) } } stage = MainStage.go()//{ loop: false })
Run
Meta Data
title Using createPattern()
imports ()
files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/math.js', '../point_src/extras.js', '../point_src/point-content.js', '../point_src/pointlist.js', '../point_src/pointlistpen.js', '../point_src/point.js', '../point_src/stage.js', 'mouse', 'dragging', 'stroke')
unused_keys ()
unknown_keys ()
filepath_exists True
path pattern-example.js
filepath pattern-example.js
clean_files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/math.js', '../point_src/extras.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.js', '../point_src/pointlistdraw.js', '../point_src/pointlistgradient.js', '../point_src/pointlistshape.js', '../point_src/pointlistgenerator.js', '../point_src/unpack.js', '../point_src/pointlist.js', '../point_src/pointlistpen.js', '../point_src/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/functions/clamp.js', '../point_src/distances.js', '../point_src/protractor.js', '../point_src/text/beta.js', '../point_src/dragging.js', '../point_src/setunset.js', '../point_src/stroke.js')
markdown {'html': '<p>Presenting the raw feature <code>ctx.createPattern()</code>, we can generate a "pattern"\nusing an <code>OffscreenCanvas</code> and apply it as a fill.</p>', 'content': 'title: Using createPattern()\nfiles:\n ../point_src/core/head.js\n ../point_src/pointpen.js\n ../point_src/pointdraw.js\n ../point_src/math.js\n ../point_src/extras.js\n ../point_src/point-content.js\n ../point_src/pointlist.js\n ../point_src/pointlistpen.js\n ../point_src/point.js\n ../point_src/stage.js\n mouse\n dragging\n stroke\n---\n\nPresenting the raw feature `ctx.createPattern()`, we can generate a "pattern"\nusing an `OffscreenCanvas` and apply it as a fill.'}