Skip to content

Commit

Permalink
update 2019-02-21
Browse files Browse the repository at this point in the history
  • Loading branch information
lavrton committed Feb 22, 2019
1 parent 33f83a9 commit 9105943
Show file tree
Hide file tree
Showing 57 changed files with 109 additions and 91 deletions.
4 changes: 2 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ language: en

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://konvajs.github.io
url: https://konvajs.org
root: /
permalink: news/:year/:month/:day/:title/
tag_dir: tags
Expand Down Expand Up @@ -78,7 +78,7 @@ disqus_shortname: konvajs
## Themes: https://github.com/tommy351/hexo/wiki/Themes
theme: hexo3
exclude_generator:
- home
- home

# Deployment
## Docs: http://hexo.io/docs/deployment.html
Expand Down
2 changes: 1 addition & 1 deletion jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"highlightTutorialCode": true,
"analytics": {
"ua": "UA-54202824-2",
"domain": "https://konvajs.github.io"
"domain": "https://konvajs.org"
},
"outputSourceFiles": false
},
Expand Down
6 changes: 3 additions & 3 deletions react-demos/images/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { render } from 'react-dom';
import { Stage, Layer, Image } from 'react-konva';
import useImage from 'use-image';

// the first very simple and recomended way:
// the first very simple and recommended way:
const LionImage = () => {
const [image] = useImage('https://konvajs.github.io/assets/lion.png');
const [image] = useImage('https://konvajs.org/assets/lion.png');
return <Image image={image} />;
};

Expand Down Expand Up @@ -65,7 +65,7 @@ class App extends Component {
return (
<Stage width={window.innerWidth} height={window.innerHeight}>
<Layer>
<URLImage src="https://konvajs.github.io/assets/yoda.jpg" x={150} />
<URLImage src="https://konvajs.org/assets/yoda.jpg" x={150} />
<LionImage />
</Layer>
</Stage>
Expand Down
2 changes: 1 addition & 1 deletion source/docs/animations/Create_an_Animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The update function should only contain logic that updates Node properties,
such as `position`, `rotation`, `scale`, `width`, `height`, `radius`, `colors`, etc.
Once the animation has been created, we can start it at anytime with the `start()` method.

For a full list of attributes and methods, check out the [Konva.Animation documentation](https://konvajs.github.io/api/Konva.Animation.html).
For a full list of attributes and methods, check out the [Konva.Animation documentation](/api/Konva.Animation.html).

## HTML5 Canvas Konva Animation Template

Expand Down
2 changes: 1 addition & 1 deletion source/docs/animations/Moving.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: HTML5 Canvas Animate Position Tutorial
To animate a shape's position with Konva, we can create a new animation with `Konva.Animation`
which modifies the shape's position with each animation frame.

For a full list of attributes and methods, check out the [Konva.Animation documentation](https://konvajs.github.io/api/Konva.Animation.html).
For a full list of attributes and methods, check out the [Konva.Animation documentation](/api/Konva.Animation.html).

{% iframe /downloads/code/animations/Moving.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/animations/Rotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To animate a shape's rotation with Konva, we can create a new animation with
In this tutorial, we'll rotate a blue rectangle about the top left corner,
a yellow rectangle about its center, and a red rectangle about an outside point.

For a full list of attributes and methods, check out the [Konva.Animation documentation](https://konvajs.github.io/api/Konva.Animation.html).
For a full list of attributes and methods, check out the [Konva.Animation documentation]/api/Konva.Animation.html).

{% iframe /downloads/code/animations/Rotation.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/animations/Scaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ of a yellow hexagon, and the x component of a red hexagon about an axis position

Instructions: drag and drop the hexagons as they animate

For a full list of attributes and methods, check out the [Konva.Animation documentation](https://konvajs.github.io/api/Konva.Animation.html).
For a full list of attributes and methods, check out the [Konva.Animation documentation](/api/Konva.Animation.html).

{% iframe /downloads/code/animations/Scaling.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/animations/Stop_Animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To restart the animation, we can again call the `start()`.

Instructions: Click on "Start" to start the animation and "Stop" to stop the animation.

For a full list of attributes and methods, check out the [Konva.Animation documentation](https://konvajs.github.io/api/Konva.Animation.html).
For a full list of attributes and methods, check out the [Konva.Animation documentation](/api/Konva.Animation.html).

{% iframe /downloads/code/animations/Stop_Animation.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/clipping/Clipping_Regions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ property of a group or a layer.
Clipping regions are defined by an `x`, `y`, `width`, and `height`. In this tutorial,
we'll draw blobs inside of a rectangular clipping region applied to a group.

For more complex cases take a look into clipping function. [Clipping Function](https://konvajs.github.io/docs/clipping/Clipping_Function.html)
For more complex cases take a look into clipping function. [Clipping Function](/docs/clipping/Clipping_Function.html)

{% iframe /downloads/code/clipping/Clipping_Regions.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Blur.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and set the blur amount with the `blurRadius` property.

Instructions: Slide the control to adjust the blur radius.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Blur.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Brighten.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Negative values darken the image, and positive values brighten the image.

Instructions: Slide the control to adjust the brightness

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Brighten.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Contrast.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To change contrast of an image with Konva, we can use the `Konva.Filters.Contras

Instructions: Slide the control to change contrast value.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Contrast.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Custom_Filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In this demo we will create custom filter that will draw solid border around ima
Since following contour is a complex thing we will use a hack. So we will use blurred shadow as a border foundation.
We will replace transparent/blurred pixels with our solid color that we want for border.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Custom_Filter.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Emboss.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function. Then apply filter with `filter()` function.

Instructions: Slide the controls to change emboss values.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Emboss.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Enhance.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and set the enhance amount with the `enhance` property.

Instructions: Slide the control to adjust the enhance value.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Enhance.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Grayscale.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To apply filter to an `Konva.Image`, we have to cache it first with `cache()` fu
To invert the colors of an image with Konva, we can use the
`Konva.Filters.Grayscale` filter.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Grayscale.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/HSL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To change hue, saturation and luminance components of an image with Konva, we ca

Instructions: Slide the controls to change hsl values.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/HSL.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/HSV.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To change hue, saturation and value components of an image with Konva, we can us

Instructions: Slide the controls to change hsv values.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/HSV.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Invert.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To apply filter to an `Konva.Image`, we have to cache it first with `cache()` fu
To invert the colors of an image with Konva, we can use the
`Konva.Filters.Invert` filter.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Invert.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Kaleidoscope.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ filter and set the `kaleidoscopePower` and `kaleidoscopeAngle` properties.

Instructions: Slide the control to adjust the kaleidoscope angle.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Kaleidoscope.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Mask.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To apply filter to an `Konva.Image`, we have to cache it first with `cache()` fu
To mark the colors of an image with Konva, we can use the
`Konva.Filters.Mask` filter.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Mask.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Multiple_Filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: HTML5 Canvas Multiple Filters Tutorial
To apply multiple filters to an `Konva.Image`, we have to cache it first with `cache()`
function. Then apply filters with `filter()` function.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Multiple_Filters.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Noise.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To change noise of an image with Konva, we can use the `Konva.Filters.Noise`.

Instructions: Slide the control to change noise value.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Noise.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/Pixelate.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To change pixelate effect of an image with Konva, we can use the `Konva.Filters.

Instructions: Slide the control to change pixel size value.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/Pixelate.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/RGB.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To change rgb components of an image with Konva, we can use the `Konva.Filters.R

Instructions: Slide the controls to change rgb values.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/RGB.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/filters/RGBA.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To change rgba components of an image with Konva, we can use the `Konva.Filters.

Instructions: Slide the controls to change rgba values.

For all available filters go to [Filters Documentation](https://konvajs.github.io/api/Konva.Filters.html).
For all available filters go to [Filters Documentation](/api/Konva.Filters.html).

{% iframe /downloads/code/filters/RGBA.html %}

Expand Down
2 changes: 1 addition & 1 deletion source/docs/groups_and_layers/Groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ a `Konva.Group()` object and then add shapes to it with the `add()` method.
Grouping shapes together is really handy when we want to transform multiple
shapes together, e.g. if we want to move, rotate, or scale multiple shapes
at once. Groups can also be added to other groups to create more complex
Node trees. For a full list of attributes and methods, check out the [Konva.Group documentation](https://konvajs.github.io/api/Konva.Group.html).
Node trees. For a full list of attributes and methods, check out the [Konva.Group documentation](/api/Konva.Group.html).

{% iframe /downloads/code/groups_and_layers/Groups.html %}

Expand Down
18 changes: 9 additions & 9 deletions source/docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,24 @@ circle.on('dragend', function() {
console.log('drag stopped');
});
```
See [working example](https://konvajs.github.io/docs/events/Binding_Events.html).
See [working example](/docs/events/Binding_Events.html).

## DRAG AND DROP

`Konva` has builtin drag support. For the current moment there is no `drop` events (`drop`, `dragenter`, `dragleave`, `dragover`)
but it is very easy to implement them [via framework](https://konvajs.github.io/docs/drag_and_drop/Drop_Events.html).
but it is very easy to implement them [via framework](/docs/drag_and_drop/Drop_Events.html).

To enable drag&drop just set property draggable = true.

```
shape.draggable('true');
```

Then you can subscribe to drag&drop events and setup [moving limits](https://konvajs.github.io/docs/drag_and_drop/Complex_Drag_and_Drop.html).
Then you can subscribe to drag&drop events and setup [moving limits](/docs/drag_and_drop/Complex_Drag_and_Drop.html).

## Filters

`Konva` has several filters: blur, invert, noise etc. For all available filters see [Filters API](https://konvajs.github.io/api/Konva.Filters.html).
`Konva` has several filters: blur, invert, noise etc. For all available filters see [Filters API](/api/Konva.Filters.html).

Example:
![Filter](/assets/overview-filter.png)
Expand All @@ -178,7 +178,7 @@ Example:

You can create animations in two ways:

1. via `Konva.Animation` [Demo](https://konvajs.github.io/docs/animations/Moving.html):
1. via `Konva.Animation` [Demo](/docs/animations/Moving.html):
```
var anim = new Konva.Animation(function(frame) {
var time = frame.time,
Expand All @@ -189,7 +189,7 @@ var anim = new Konva.Animation(function(frame) {
anim.start();
```

2. via `Konva.Tween` [Demo](https://konvajs.github.io/docs/tweens/Linear_Easing.html):
2. via `Konva.Tween` [Demo](/docs/tweens/Linear_Easing.html):
```
var tween = new Konva.Tween({
node: rect,
Expand Down Expand Up @@ -254,11 +254,11 @@ var stage = Konva.Node.create(json, 'container');
```
shape.cache();
```
[Demo](https://konvajs.github.io/docs/performance/Shape_Caching.html)
[Demo](/docs/performance/Shape_Caching.html)

2. Layering. As framework supports several `<canvas>` elements you can put objects at your discretion.
For example your application consists from complex background and several moving shapes. You can use one layer for background and another one for shapes.
While updating shapes you don't need to update background canvas. [Demo](https://konvajs.github.io/docs/performance/Layer_Management.html)
While updating shapes you don't need to update background canvas. [Demo](/docs/performance/Layer_Management.html)

You can find all available performance tips here:
[https://konvajs.github.io/docs/performance/All_Performance_Tips.html](https://konvajs.github.io/docs/performance/All_Performance_Tips.html)
[https://konvajs.org/docs/performance/All_Performance_Tips.html](/docs/performance/All_Performance_Tips.html)
24 changes: 12 additions & 12 deletions source/docs/performance/All_Performance_Tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ Don't want to spend your time with performance issues? Request a [performance re

There is a full list of useful performance tips:

1. [Shape Caching](https://konvajs.github.io/docs/performance/Shape_Caching.html)
2. [Layer Management](https://konvajs.github.io/docs/performance/Layer_Management.html)
3. [`batchDraw` method](https://konvajs.github.io/docs/performance/Batch_Draw.html)
4. [Optimize Animation](https://konvajs.github.io/docs/performance/Optimize_Animation.html)
5. [Shape Redraw](https://konvajs.github.io/docs/performance/Shape_Redraw.html)
1. [Shape Caching](/docs/performance/Shape_Caching.html)
2. [Layer Management](/docs/performance/Layer_Management.html)
3. [`batchDraw` method](/docs/performance/Batch_Draw.html)
4. [Optimize Animation](/docs/performance/Optimize_Animation.html)
5. [Shape Redraw](/docs/performance/Shape_Redraw.html)
6. If your shape has only position transformation (`x` and `y`, no `scale`, `rotation`) set `transformsEnabled = 'position'`
7. If you don't need event on layer set `layer.hitGraphEnabled(false)`. Or use [Konva.FastLayer](https://konvajs.github.io/api/Konva.FastLayer.html). See [Demo](https://konvajs.github.io/docs/sandbox/Animation_Stress_Test.html)
7. If you don't need event on layer set `layer.hitGraphEnabled(false)`. Or use [Konva.FastLayer](/api/Konva.FastLayer.html). See [Demo](/docs/sandbox/Animation_Stress_Test.html)
8. For mobile application set viewport: `<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">`
9. If you have bad performance on retina devices set `Konva.pixelRatio = 1`. Make sure that quality of result is ok for you.
10. While dragging a node you can move it on separate layer. Then move it back to original layer. See [Demo](https://konvajs.github.io/docs/sandbox/Drag_and_Drop_Stress_Test.html)
11. [Optimize Stroke Drawing](https://konvajs.github.io/docs/performance/Optimize_Strokes.html)
12. If a shape has fill, stroke and opacity you may set `shape.perfectDrawEnabled(false)`. See demo for more information [Disable Perfect Drawing](https://konvajs.github.io/docs/performance/Disable_Perfect_Draw.html).
13. Try to set `shape.listening(false)` where possible. For more info read [Listening false](https://konvajs.github.io/docs/performance/Listening_False.html).
14. [Avoid Memory Leaks](https://konvajs.github.io/docs/performance/Avoid_Memory_Leaks.html).
15. Don't create large stages. Try to make canvases as small, as possible. 8000px wide canvas is blah 🤢. [use this tip instead](https://konvajs.github.io/docs/sandbox/Canvas_Scrolling.html)
10. While dragging a node you can move it on separate layer. Then move it back to original layer. See [Demo](/docs/sandbox/Drag_and_Drop_Stress_Test.html)
11. [Optimize Stroke Drawing](/docs/performance/Optimize_Strokes.html)
12. If a shape has fill, stroke and opacity you may set `shape.perfectDrawEnabled(false)`. See demo for more information [Disable Perfect Drawing](/docs/performance/Disable_Perfect_Draw.html).
13. Try to set `shape.listening(false)` where possible. For more info read [Listening false](/docs/performance/Listening_False.html).
14. [Avoid Memory Leaks](/docs/performance/Avoid_Memory_Leaks.html).
15. Don't create large stages. Try to make canvases as small, as possible. 8000px wide canvas is blah 🤢. [use this tip instead](/docs/sandbox/Canvas_Scrolling.html)
16. Do not create too many layers. Usually 3-5 is max.
17. Hide (or remove from layer) invisible objects (or objects that go out of the screen).

Loading

0 comments on commit 9105943

Please sign in to comment.