Category: Easeljs examples

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

EaselJS / Canvas Example : Follow Drone

I'm fairly new to Canvas. I've been trying to get the images reversed in this EaselJS Alpha Mask example so that the initial image is clear, and what you paint is blurry; basically, the reverse of the demo. I've been playing around with it for hours, applying filters to the bitmap var and removing them from the blur var.

Everything I do just doesn't work. Seems like it would be an easy fix of just switching things around but that doesn't seem to be the case. Not for me anyway. Does anybody have an example of this, or know what to do? I could provide code examples of what I did, but it's basically just playing around with stuff like a monkey on a typewriter. Here's the code on Github. Since you want to reveal the blur instead, add them in the reverse order.

This puts the blur on top. This is where you probably got tripped up. If you set the filters on the blurImage to just the maskFilterit will not appear to work. The maskFilter IS working, but will have removed the blur and color filters that were applied. To add the maskFilter, you have to put it in the array with the current filters.

This is my approach, which ensures the original 2 filters are intact, and the maskFilter is just added once:. In my opinion, this effect isn't as obvious - so you might want to increase the opacity of the brush:.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here.

Subscribe to RSS

Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I'm working with CreateJS and wondered if anyone here has examples of controlling tweens using the Ticker object.

I'm trying to get a sprite to follow a path defined by waypoints but i don't want to control each tween in between waypoints by time. I want to have smooth movement between each waypoint controlled by the Ticker object.

I tried this code which doesn't seem to work at all. This code seems to only jump between waypoints and not tween at all. You need to add a duration in milliseconds to your tween, otherwise it would default to 0, this will cause the "jump", e. Learn more. Asked 7 years, 1 month ago. Active 7 years, 1 month ago.

Viewed 4k times. Gary Willoughby Gary Willoughby Active Oldest Votes. Thanks but I want to control the ticks manually because the waypoints are not equal distances apart therefor if I used a timer the sprite would be faster across waypoints that are further away from each other. If your waypoints are not equally apart you should calculate the distance to the next waypoint and set the duration based on the distance.

In any case you HAVE to set a duration if you don't want your person to "jump" - how should the TweenEngine know how much to advance if no duration is set? If you still want to control it yourself you can use.Check out the repository for more tutorials and a handful of helpful samples.

When choosing a font it is important to know that browsers will only display fonts that are installed on the viewers machine. Lucky for us CSS has a fallback system: if the font you have selected is not installed, the browser will choose a similar font from a generic font set.

Serif fonts have small lines tailing on the end of the main strokes of the letters. Sans-serif fonts have straight ends to letters and therefore have a much cleaner designs. Letters and characters each occupy the same amount of horizontal space Non-monospace fonts have different widths.

Cursive fonts either have joining strokes or other cursive characteristics, such as handwriting styles. Fantasy fonts usually decorative fonts and are often used for titles.

They are not designed for long bodies of text. The font property allows for any valid CSS font attribute. The font family property specifies what font will be displayed. Common font names would be fonts like HelveticaArialCourieretc. CSS provides a fallback, since all fonts might not be availble on all computers. Generic families are these fallback: serifsans-serifcursivefantasymonospace. For more information common fonts on all systems click here. Alternatively, you can pass string, font-family and color value parameters to the constructor.

One benefit for choosing Google Web Fonts is the caching benefits and bandwidth saving, since those fonts are stored on Google servers. What you'll need to do first is head over to Google's font Catalog. Examples: Arial Verdana Helvetica. Examples: Courier Courier New. Examples: Comic Sans Monotype Corsiva. Examples: Impact Haettenschweiler.I have put together quite a few examples and experiments and will be posting them along with what I learned from them over the next couple of weeks.

It basically uses EaselJS to create a snake like shape that follows you mouse. Here is a screen shot of a graphic I created with it:. Here is an inline version of the example that you can play with. Just click to toggle whether the drone follows your mouse requires a browser with support for the HTML5 Canvas element. You can view the example fullscreen which looks better here.

Im going to write a series of posts over the next couple of days on a couple of things I learned while building this example.

easeljs examples

In the mean time, here is the main gist of what is going on:. Again, you can view the full version of the example hereand view and download all of the code from here. I will be making some more posts over the next couple of days, going into more detail on the example, as well as some of the lessons I learned from making it. In the meantime, post any questions or comments below.We are always looking for ways to optimize, simplify, or create better workflows in CreateJS, and the ScaleBitmap is a great example of this.

We know, we know… ScaleBitmap aka Scale9 or 9-slicewas a UI pattern long before Flash, but it was certainly popularized by Adobe when it was included as a built-in behaviour in Flash and ActionScript 2.

The grid, stretched vertically and horizontally. This lets you create sprites that can be scaled to any size, while distorting parts of the content in a predictable way. In the sample shipped with EaselJS, a simple speech bubble image has been provided, which scales to random sizes when clicked.

ScaleBitmap Sample Image. Here is a quick codepen fork of the previous demo, where the image can be swapped out to see better how the content scales apologies to Grant for using his likeness.

To use the ScaleBitmap class, download and include it in your project EaselJS does not include it as part of the minified or combined libraries.

The grid is specified using a CreateJS Rectangle that defines the center square x, y, width, and height. This exact idea was used in this anniversary codepenallowing the text in the bubble to change, and the bubble to scale to fit the contents without distorting the graphics. It is also possible to cache dynamic content, and apply ScaleBitmap afterwards.

Here is an example. Other approaches might make more sense for assets drawn with vector Graphics such as changing properties using Commands.

ScaleBitmap is not currently supported by StageGL. Creating high fidelity experiences now often comes with the cost of creating assets for a bunch of different resolutions, perspectives, and even performance profiles.

easeljs examples

It means content must be authored at retina and higher resolutions to work on any device, and potentially sends a ton of content over the network, or requires complex loading schemas to choose the right asset to download and display. We like to think that utilities like the ScaleBitmap can help chip away at this challenge. Your email address will not be published. Notify me of followup comments via e-mail. Leave a Reply Cancel reply Your email address will not be published.Check out the repository for more tutorials and a handful of helpful samples.

The hitTest method checks a specified point in a display object and returns true if that point is not fully transparent ie. This can be used for checking if a specific object is under the mouse and hit detection. The following demo calls circle. This simple implementation works fine when the circle hasn't been moved or transformed, but hitTest expects the position passed to it to be in the local coordinate space.

The stage. To see this behaviour, try changing the circle. To convert a global position into a local one, we can use the globalToLocal method. This code converts the stage mouse position into a local position and outputs it to the console. The demo below applies this same code to check when transformed shapes are under the mouse. Check out the source in globalToLocal. The globalToLocal method works great if we're checking a stage position, but what about if you want to check hitTest against a point in another transformed object?

You could use localToGlobal and then its counterpart globalToLocal to convert the point from one object's coordinate space to another's, but the localToLocal method does the same thing with a little less code.

The following example show this being used to convert a position ,0 on a rotating arm into a position relative to a target shape, to show when that point intersects the target. Check out localToLocal.Homepage Github. The Easel Javascript library provides a full, hierarchical display list, a core interaction model, and helper classes to make working with the HTML5 Canvas element much easier.

It provides a feature-rich display list to allow you to manipulate and animate graphics. It also provides a robust interactive model for mouse and touch interactions. It is excellent for building games, generative art, ads, data visualization, and other highly graphical experiences. It has no external dependencies, and should be compatible with virtually any framework you enjoy using.

It was built by gskinner. We appreciate credit where possible, but it is not a requirement. Check out the docs for more information. Exposes all of the display properties ex.

easeljs examples

Stage The root level display container for display elements. Each time tick is called on Stage, it will update and render the display list to its associated canvas.

Container A nestable display container, which lets you aggregate display objects and manipulate them as a group. Bitmap Draws an image, video or canvas to the canvas according to its display properties. Sprite Displays single frames or animations from sprite sheets, and provides APIs for managing playback and sequencing.

Graphics Provides an easy to use API for drawing vector data.

easeljs examples

Can be used with Shape, or completely stand alone. Filter The base filter class that other filters ex. BlurFilter, ColorMatrixFilter, etc extend. Shadow Defines all of the properties needed to display a shadow on a display object. Ticker Provides a pausable centralized tick manager for ticking Stage instances or other time based code.

SpriteSheet Encapsulates all the data associated with a sprite sheet to be used with Sprite. SpriteSheetUtils Contains utility methods for extending existing sprite sheets with flipped frames and extracting individual frames. Get the filesize savings of vector, with the performance of a SpriteSheet. Matrix2D Represents a 3x3 affine transformation matrix. Used internally for calculating concatenated transformations.

Shape ; shape.