diff --git a/README.md b/README.md index 4d7aae7..64f24e1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [Documentation (under construction)](https://web-spinner.vercel.app) +[Learn with examples (under construction)][https://web-spinner.vercel.app/learn-canvas.html] + [Starter Template](https://github.com/calebfoss/web-spinner-starter) [Contributor Documents (under construction)](./contributor/introduction.md) diff --git a/docs/docStyle.css b/docs/docStyle.css index 2ccdd25..6441164 100644 --- a/docs/docStyle.css +++ b/docs/docStyle.css @@ -81,6 +81,10 @@ main { text-decoration: none; } + a:visited { + color: var(--lightest); + } + a:hover { background-color: var(--dark); text-decoration: underline; diff --git a/docs/learn-canvas.html b/docs/learn-canvas.html new file mode 100644 index 0000000..31557b0 --- /dev/null +++ b/docs/learn-canvas.html @@ -0,0 +1,423 @@ + + + + + + + + + + Web-Spinner - Learn: Canvas + + +
+
+ + +
+
+
+

Web-Spinner - Learn: Canvas

+

Introduction

+

+ This is a beginner-friendly guide to using the 2D canvas in Web Spinner. + The guide covers how to create graphics, animations, and interactive + content. +

+

Setup

+

+ You can create a Web Spinner project using either HTML or JavaScript. + HTML is simpler but more limited. JavaScript allows for more + opportunities with animation and interactivity. Let's begin with a + blank canvas and look at both options. +

+
+

HTML

+

+ See the Pen + + Web Spinner Learn HTML 01 + by Caleb Foss (@calebfoss) on CodePen. +

+

+ c2d stands for Canvas 2D, meaning a space to render + two-dimensional imagery. +

+

+ The canvas is an example of an element, a unit of content on a web + page. +

+
+
+

JavaScript

+

+ See the Pen + + Web Spinner Learn JS 01 + by Caleb Foss (@calebfoss) on CodePen. +

+

+ The lines in the code that begin with // are called + comments. They are ignored by the browser and meant instead for humans to + read. In this case, they describe what each line of code does. +

+
+

Try changing the canvas settings.

+ +

Drawing Shapes

+

Start with One Shape

+

Let's put a shape on the canvas.

+
+

HTML

+

+ See the Pen + + Web Spinner Learn HTML 02 + by Caleb Foss (@calebfoss) on CodePen. +

+
+
+

JavaScript

+

+ See the Pen + + Web Spinner Learn JS 02 + by Caleb Foss (@calebfoss) on CodePen. +

+
+

Adding Another

+

+ How we add another shape changes its behavior. When a shape is added + directly to the canvas, it starts with default settings. When a shape is + added as a child of another shape, however, it starts with that + shape's settings. +

+
+

HTML

+

+ See the Pen + + Web Spinner Learn HTML 03-b + by Caleb Foss (@calebfoss) on CodePen. +

+

+ See the Pen + + Web Spinner Learn HTML 03-a + by Caleb Foss (@calebfoss) on CodePen. +

+
+
+

JavaScript

+

+ See the Pen + + Web Spinner Learn JS 02 + by Caleb Foss (@calebfoss) on CodePen. +

+

+ See the Pen + + Web Spinner Learn JS 03-a + by Caleb Foss (@calebfoss) on CodePen. +

+
+
+ + + diff --git a/jest.config.js b/jest.config.js index 91922e9..9c5263a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -12,5 +12,5 @@ export default { extensionsToTreatAsEsm: [".ts"], collectCoverage: true, coverageReporters: ["text"], - collectCoverageFrom: ["dist/*"], + collectCoverageFrom: ["src/**/*"], }; diff --git a/package-lock.json b/package-lock.json index 7167c94..ab5611d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "web-spinner", + "name": "@calebfoss/web-spinner", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "dev": true, "packages": { "": { - "name": "web-spinner", + "name": "@calebfoss/web-spinner", "version": "0.0.0", "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 11350f1..4797986 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,9 @@ "webpack": "^5.97.1", "webpack-cli": "^6.0.1" }, - "name": "web-spinner", + "name": "@calebfoss/web-spinner", "version": "0.0.0", - "main": "dist/webSpinner.js", + "main": "src/index.ts", "type": "module", "types": "dist/types/index.d.ts", "scripts": {