Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepbox8646 committed Jul 24, 2024
2 parents 800bf61 + a924e29 commit 13b6d03
Show file tree
Hide file tree
Showing 16 changed files with 5,317 additions and 6,412 deletions.
46 changes: 46 additions & 0 deletions docs/content/guide/basic/demos/demo-text-group.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<template>
<canvas ref="canvas" width="600" height="300"></canvas>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
import * as nc from 'newcar'
const canvas = ref<HTMLCanvasElement>()
onMounted(async () => {
await nc.useFont('https://storage.googleapis.com/skia-cdn/misc/Roboto-Regular.ttf')
const engine = await new nc.CarEngine()
.init('https://unpkg.com/canvaskit-wasm@latest/bin/canvaskit.wasm')
const app = engine.createApp(canvas.value!).setBackgroundColor('transparent')
const scene = nc.createScene(
new nc.TextGroup([
new nc.Text('Hello', {
x: 100,
y: 100,
style: {
fontSize: 50,
fill: true
}
}),
new nc.Text(' world!', {
x: 100,
y: 150,
style: {
fontSize: 20,
fill: true,
}
}),
// ...
], {
width: 600,
x: 200,
y: 200
})
)
app.checkout(scene)
app.play()
})
</script>
31 changes: 31 additions & 0 deletions docs/content/guide/basic/demos/demo-text.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<canvas ref="canvas" width="600" height="300"></canvas>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
import * as nc from 'newcar'
const canvas = ref<HTMLCanvasElement>()
onMounted(async () => {
await nc.useFont('https://storage.googleapis.com/skia-cdn/misc/Roboto-Regular.ttf')
const engine = await new nc.CarEngine()
.init('https://unpkg.com/canvaskit-wasm@latest/bin/canvaskit.wasm')
const app = engine.createApp(canvas.value!).setBackgroundColor('transparent')
const scene = nc.createScene(
new nc.Text('Hello world!', {
x: 100,
y: 100,
style: {
fillColor: nc.Color.parse('red'),
fontSize: 50
}
})
)
app.checkout(scene)
app.play()
})
</script>
Binary file added docs/content/guide/basic/demos/font.ttf
Binary file not shown.
20 changes: 13 additions & 7 deletions docs/content/guide/basic/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
title: Text and TextGroup
---

<script setup lang="ts">
import { default as DemoText } from './demos/demo-text.vue'
import { default as DemoTextGroup } from './demos/demo-text-group.vue'
</script>

# `Text` and `TextGroup`

## `Text`
Expand All @@ -22,7 +27,6 @@ widget.add(
x: 100,
y: 100,
style: {
color: nc.Color.parse('skyblue'),
fontSize: 50
},
width: 500
Expand All @@ -33,7 +37,7 @@ widget.add(

```

![The demonstration of the Text component, the sky blue "Hello world!"](/basic/text-and-textgroup-01.png)
<DemoText/>

## `TextGroup`

Expand All @@ -50,16 +54,18 @@ widget.add(
x: 100,
y: 100,
style: {
color: nc.Color.parse('skyblue'),
fontSize: 50
fontSize: 50,
fill: false,
border: true,
}
}),
new nc.Text(' world!', {
x: 100,
y: 150,
style: {
color: nc.Color.parse('red'),
fontSize: 30
fontSize: 30,
fill: false,
border: true,
}
}),
// ...
Expand All @@ -74,7 +80,7 @@ widget.add(

```

![The demonstration of the TextGroup component, the sky blue "Hello" and the red " world!"](/basic/text-and-textgroup-02.png)
<DemoTextGroup/>

## See Also:

Expand Down
2 changes: 1 addition & 1 deletion mods/mod-geometry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@newcar/mod-geometry",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "",
"author": "BugDuck Team",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion mods/mod-markdown/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@newcar/mod-markdown",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "",
"author": "BugDuck Team",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion mods/mod-math/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@newcar/mod-math",
"type": "module",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "",
"author": "BugDuck Team",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"preversion": "pnpm clean && pnpm build",
"build": "pnpm run --filter=* build",
"build": "pnpm run --filter=./packages/** build",
"dev": "pnpm run --parallel --filter=* dev",
"test": "pnpm run --filter=* test",
"serve": "vite ./examples/",
Expand Down
2 changes: 1 addition & 1 deletion packages/basic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@newcar/basic",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "The basic objects, animations and interpolators of newcar.",
"author": "BugDuck Team",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@newcar/core",
"type": "module",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "The core of newcar.",
"author": "BugDuck Team",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/newcar/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "newcar",
"type": "module",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "A Highly configurable universal advanced engine, Born for creating animation rapidly.",
"author": "BugDuck Team",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/recorder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@newcar/recorder",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "The utils of newcar",
"author": "BugDuck Team",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@newcar/utils",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "The utils of newcar",
"author": "BugDuck Team",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion plugins/plugin-debug/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@newcar/plugin-debug",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "",
"author": "BugDuck Team",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion plugins/plugin-timeview/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@newcar/plugin-timeview",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "",
"author": "BugDuck Team",
"license": "Apache-2.0",
Expand Down
Loading

0 comments on commit 13b6d03

Please sign in to comment.