Introducing Starling JS

Starling JS is a powerful JavaScript library that makes creating 2D and 3D animations easier than ever before. With Starling, you can create beautiful and sophisticated animations with just a few lines of code, making it the perfect choice for any web developer looking to add some extra flair to their projects.

In this article, we’ll take a look at some of the basics of using Starling JS, including how to create simple animations and manipulate 3D objects. We’ll also explore some of the more advanced features of Starling, such as using physics simulations and working with textures. So let’s get started!

logo of framework starling js
Source: https://en.wikipedia.org/wiki/Starling_Framework#/media/File:Starling-flying.png

AS3 Vs JS

ActionScript 3 (AS3) is a programming language that is used to develop applications for Adobe Flash Player and Adobe AIR. AS3 was first released in 2006, and it is based on ECMAScript, the same scripting language that JavaScript is based on.

AS3 is a powerful and flexible language that has many features that are not found in JavaScript. For example, AS3 supports static type checking, which can help to prevent errors in code. In addition, AS3 provides support for inheritance, which allows programmers to create new classes that inherit from existing classes. As a result, AS3 code is typically more reliable and easier to maintain than JavaScript code.

However, AS3 code is also generally more complex than JavaScript code, and it can be more difficult to learn for beginners.

JavaScript is a widely-used, lightweight programming language that was created in 1995. JavaScript is often used to create dynamic web content, such as interactive menus and animations. It is also used to create applications for the web browser and for mobile devices.

JavaScript is a relatively simple language that has a smaller learning curve than AS3. In addition, JavaScript code tends to be more concise and easier to read than AS3 code. However, JavaScript does not have as many features as AS3, and it can be less reliable in some cases.

So which language should you use? If you are new to programming, then JavaScript is probably the better choice. However, if you are an experienced programmer, then AS3 may be a better option.

Starling Vs Other Animation Libraries

There are a number of animation libraries available for web development, each with its own strengths and weaknesses.

Starling is unique in that it provides both 2D and 3D animation capabilities, making it a good choice for projects that require more sophisticated animations. In contrast, other animation libraries such as GreenSock and Velocity focus primarily on 2D animation, while libraries such as three.js focus exclusively on 3D animation.

Another advantage of Starling is that it is written in JavaScript, making it accessible to a wider range of developers. In contrast, many of the other animation libraries are written in ActionScript 3 (AS3), which may be unfamiliar to developers who are not experienced with AS3.

Finally, Starling has a strong community behind it, with a large number of developers who are willing to offer help and support. This can be invaluable when faced with difficult problems or obscure errors.

All in all, Starling is an excellent choice for developers looking to create sophisticated 2D and 3D animations. It has a wide range of features, it is accessible to a wide range of developers, and it has a strong community behind it. So why not give it a try?

What Is Adobe AIR?

Adobe AIR is a cross-platform runtime system that allows developers to create applications that will run on multiple devices. The runtime system provides a set of common APIs that can be used on any supported platform, allowing developers to write code once and deploy it to multiple systems.

Adobe AIR also includes support for hardware acceleration, which can improve the performance of applications on mobile devices. In addition, Adobe AIR includes a set of security features that help to protect users from malicious software.

Overall, Adobe AIR is a powerful tool for developing cross-platform applications.

The Current State Of Flash And AIR

It’s no secret that Adobe’s Flash and AIR platforms have been in decline for some time now. Adobe has been gradually shifting its focus away from Flash and AIR, and towards other products such as Animate CC. As a result, the future of both Flash and AIR is very uncertain.

However, there are still a number of people who rely on these technologies for their livelihoods. For many developers, Flash and AIR offer a unique set of features that are simply not available anywhere else. As long as there is demand for these technologies, there will be someone there to meet it.

However, it is important to keep in mind that the current state of Flash and AIR is very unstable. The platform is slowly being phased out by Adobe, and it is likely that it will eventually be discontinued. If you are relying on Flash or AIR for your development work, it is important to keep this in mind and be prepared for the eventual transition to other technologies.

Introducing Starling JS

Starling JS is a powerful open source JavaScript library for building cross-platform applications. It enables developers to create rich user interfaces and interactive animations using only JavaScript and HTML5. Starling JS is used by some of the world’s leading companies, including Facebook, Google, Netflix, and Twitter. 

The library is also popular among game developers and has been used to create a number of popular games, including Angry Birds. Starling is written in ActionScript 3 and utilizes the Stage3D API for hardware-accelerated graphics. The engine makes use of modern iPad and iPhone features, such as the Retina display and multi-touch input.

In addition, Starling comes with a number of built-in features, including a sprite sheet importer, an animation system, and a particle system. With its intuitive API and impressive feature set, Starling is well-suited for creating both 2D and 3D games.

While Starling JS is free to use, it requires a paid subscription for access to its premium features. However, the cost of a subscription is well worth it for the wealth of features and functionality that Starling JS provides.

Here is what it looks like –

{
    export class Hero extends display.Sprite
    {
        private _body:display.Image;
 
        constructor()
        {
            super();
 
            this._body = new display.Image(Game.assets.getTexture("hero"));
            this._body.pivotX = this._body._width / 2;
            this._body.pivotY = this._body.height;
            this.addChild(this._body);
        }
 
        public jump():void
        {
            core.Starling.current.juggler.tween(this, 0.4, {
                transition: animation.Transitions.EASE_OUT,
                y: -50,
                repeatCount: 2,
                reverse: true
            });
        }
    }
}

Why Use Starling JS?

Starling JS is a framework for building fast, lightweight 2D games.

It uses the Flash Player and Stage3D technologies to render interactive content on desktop computers, mobile devices, and TVs.

Starling JS games are built with ActionScript 3, which is a programming language that is easy to learn for developers with experience in other languages such as JavaScript, C++, or Java. The Starling JS framework provides a set of high-level APIs that make it simple to create animations, handle user input, load assets, and more.

In addition, the Starling JS community has created a variety of helpful plugins and classes that can be used to build even more sophisticated games. As a result, Starling JS is an excellent choice for anyone looking to create 2D games for the web.

There are many reasons to choose Starling as your game engine, but here are just a few:

  1. Starling is free and open source.
  2. Starling is cross-platform, supporting a wide range of devices.
  3. Starling is fast and lightweight.
  4. Starling has a large and active community.
  5. Starling comes with a wealth of built-in features.

How To Get Started With Starling JS

If you’re looking to get started with Starling JS, the first step is to download the library.

Once you have the library downloaded, you can include it in your HTML file using a script tag. Once you have included the library, you can start using it by creating a new instance of the starling class.

In order to use the library, you will need to create a stage object. The stage object is used to hold all the visible elements that make up your StarlingJS application. To add an element to the stage, you use the addChild method. You can continue to add as many children as you like to the stage. When you are ready to render the scene, you call the render method on the stage object.

The following code shows an example of how to create a basic 2D game using Starling JS:

var stage:Stage = new Stage();

var bird:Sprite = new Sprite();

stage.addChild(bird);

bird.graphics.beginFill(0xee0000);

bird.graphics.drawCircle(100, 100, 50);

bird.graphics.endFill();

stage.render();

In this example, we create a new stage object and then add a sprite to it. The sprite is drawn with a red circle that has a radius of 50 pixels. We then call the render method on the stage object to display the scene. You can experiment with this code to create your own simple 2D games.

Starling JS In Action

If you want to see Starling JS in action, you can check out some of the games that have been created using the library.

One example is “Nano Tank“. This game features a tank that is driving around a battlefield, shooting at enemies and avoiding obstacles. The graphics are simple but effective, and the gameplay is smooth and addictive.

Another example is “Don’t Touch The Spikes“. This game features a character that is running across a platform, avoiding spikes and trying to reach the end of the level. The graphics are colorful and eye-catching, and the gameplay is challenging but addictive.

You can find more examples of games that have been created using Starling JS on the Starling JS website.

Conclusion

Starling JS is an excellent choice for creating 2D games for the web. It is free and open source, cross-platform, fast and lightweight. It also has a large and active community, and comes with a wealth of built-in features. If you’re looking to get started with game development, Starling JS is a great option.

More Resources

If you’re looking for more resources on Starling JS, the following are a few helpful places to start:

The official StarlingJS website: This is the best place to find documentation and examples for using StarlingJS.

The StarlingJS forums: This is a great place to ask questions and find help from other developers who are using StarlingJS.

StarlingJS on GitHub: This is the source code repository for StarlingJS. You can browse the code or submit pull requests if you want to contribute to the project.

Starlin API: Don’t forget to check out the Starling API Reference for detailed information about each class and method.

Leave a Comment