Giter VIP home page Giter VIP logo

dromara / newcar Goto Github PK

View Code? Open in Web Editor NEW
522.0 4.0 26.0 8.14 MB

๐ŸชขA modern animation engine for JavaScript ecosystem, which is based on Skia (canvaskit-wasm)

Home Page: https://newcarjs.org

License: Apache License 2.0

TypeScript 94.88% JavaScript 2.98% Vue 1.98% HTML 0.15% CSS 0.02%
animation-engine animation-js animation-library canvaskit canvaskit-wasm javascript skia typescript

newcar's Introduction

Newcar Banner

Newcar

A modern animation engine for JavaScript ecosystem


Examples Preview


๐Ÿ“” Introduction

Newcar is a highly configurable and advanced universal engine designed for rapid animation creation. It is suitable for a wide range of applications, including video clips, dynamic charts (planned for the future), and even 2D game development (also planned for the future).

๐ŸŒŸ Features

  • Rich API Interfaces ๐Ÿ› ๏ธ: Offers powerful and diverse APIs, providing you with greater flexibility in animation creation.
  • Based on CanvasKit-WASM ๐Ÿงฌ: Utilizes CanvasKit-WASM to minimize communication and data exchange between the CPU and GPU, ensuring robust animation performance.
  • High Degree of Customization โš™๏ธ: Features strong customizability, allowing you to create unique animation styles.
  • Chain Syntax โ›“๏ธ: Enables the use of chain syntax for a more efficient development process, eliminating the need to save objects into variables.

๐Ÿš— Future plans

  1. From the mods directory under the project root directory, it can be seen that newcar has already released mathematical modules (including number axes, planar Cartesian coordinate systems, function images, etc.). Unpublished modules include: geometry module, markup module, dynamic chart module, UI module, physics module, mind map module, etc
  2. In the future, an event system will be launched to turn it into a two in one engine for animation games
  3. Some small things, such as animation trees

โŒจ๏ธ Getting Started

Creating a Project

Although Newcar can be used in various ways, we recommend using Vite for project creation and PNPM for package management.

$ pnpm create vite project-name
$ cd project-name
$ pnpm install

Next, select your preferred framework.

Installation

$ pnpm add newcar

You will also need to install CanvasKit-WASM. For quick setup, we recommend using the CDN version.

Initialization

import * as nc from 'newcar'

const engine = await new nc.Engine().init(
  '../node_modules/canvaskit-wasm/bin/canvaskit.wasm',
)

const defaultScene = new nc.Scene(new Widget())
engine.createApp().checkout(defaultScene).play()
  1. Await init() until CanvasKit is fully loaded.
  2. Create a Scene with a root widget as its first parameter.
  3. Check out to the defaultScene and play the animation.

Simple, right? Let's dive deeper.

Adding Widgets as Root's Children

Now, let's add some excitement.

const engine = await new nc.Engine().init(
  '../node_modules/canvaskit-wasm/bin/canvaskit.wasm',
)
const defaultScene = new nc.Scene(new Widget().add(new nc.Circle(100)))
engine.createApp().checkout(defaultScene).play()

Animating It

const engine = await new nc.Engine().init(
  '../node_modules/canvaskit-wasm/bin/canvaskit.wasm',
)
const defaultScene = new nc.Scene(
  new Widget().add(new nc.Circle(100).animate(nc.create, 0, 30)),
)

These codes will add a create animation to the Circle object.

If everything is set up correctly, you will see a circle drawn on the canvas.

๐Ÿ“– Documentation

Copyright (c) 2022-present, BugDuck Team & Dromara Community

Note: Newcar is a open-source project which belong to Dromara Community and maintained by BugDuck Team. The members of BugDuck just join with a personal identity, BugDuck Team will always keep its independence

โœจ Stargazers over time

Stargazers over time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.