Skip to content

Commit

Permalink
V0.3 (#275)
Browse files Browse the repository at this point in the history
* first step of Action -> Object, SubAction -> Action (#226)

* first step of Action -> Object, SubAction -> Action
* docstring for Action
* docstrings for Object

* Implementation of render and act  (#228)

* use act and render syntax

* Working with the variable instead of the id (#230)

* working without extra identifier

* Tutorial 1 v0.3 (#244)

* tutorial 1 for v0.3

* Updated tutorial 1 explanation

Co-authored-by: Jacob Zelko <[email protected]>

* Docstrings v0.3 (#237)

* first step of Action -> Object, SubAction -> Action

* fixed unit tests

* fixed svg tests

* fix animations.jl (only morphing is missing)

* changed morphing. All tests should pass

* codecov and ambiguity

* docstring for Action

* small docstring fixes

* removed ability to have more transitions in one action

* docstrings for Object

* docstring for BackgroundObject

* copy action when adding to an object

* use act and render syntax

* working without extra identifier

* extra codecov test

* updated tutorial 1

* some docstring fixes for v0.3

* Final check on first pass of v0.3.0 docstrings

Co-authored-by: Jacob Zelko <[email protected]>

* Ability to disable an action after its last defined frame (#242)

* keep or not keep an action

* Wik feature setopacity (#241)

* implementation of setopacity

* Translation -> anim_translate and co + unit tests (#250)

* Translation -> anim_translate and co + unit tests

* Change BackgroundObject to Background (#261)

* sed and replaced all occurences of BackgroundObject to Background

* Notice about syntax change for background

* Added notice about change of Action syntax

* Formatted docstring for Background

* Tutorial 1 for v0.3 (#262)

* updated tutorial to `anim_rotate_around`
Co-authored-by: Jacob Zelko <[email protected]>

* Feature global frames (#265)

* bugfix in :same for Action and implementation of Glob
* Rel -> RFrames,  Glob to GFrames

* Example follow path v0.3 (#264)

* follow bezier path for v0.3 with GFrames

* preprocess_frames! function (#263)

* preprocess_frames! function
Co-authored-by: Jacob Zelko <[email protected]>

* Tutorial 6 for v0.3 (#267)

* tutorial 6 for v0.3
* Adjusted some grammar and light rewording of some sentences
Co-authored-by: Jacob Zelko <[email protected]>

* HowTo v0.3 (#269)

* first part of HowTo
Co-authored-by: Jacob Zelko <[email protected]>

* Updated Jarvis (#272)

* Updated Jarvis with draw_text
Co-authored-by: Jacob Zelko <[email protected]>

* LaTeX tutorial for v0.3 (#271)

* updated Latex tutorial
Co-authored-by: Jacob Zelko <[email protected]>

* [WIP] Feature transpose (#175)

- morphing several shapes 
   - i.e. transpose
Co-authored-by: Jacob Zelko <[email protected]>

* Warning if no background (#273)

* show a warning if some frames don't have a background

* Update Tutorial 2 for v0.3.0 (#268)

* Reduxed code for tutorial 2

* Changed notes from Action to Object syntax

* Cleaned code and fixed up grammar

* Fixed wording

* Fixed code

* Fixed references to Object

* Removed superfluous file

* Removed section on Animation

* v0.3 Fourier (#274)

* fourier example

* Docstrings for v0.3 (#276)

* docstrings fixes for anim_, act!, javis, SubAction, grammar
Co-authored-by: Jacob Zelko <[email protected]>

* Warning if action is defined out of object frames (#278)

* Throw warning if action is outside object frames

* test case fix + format

* Clarified warning msg

Co-authored-by: Jacob Zelko <[email protected]>

* Redux of tutorial 5 (#280)

* Redux of tutorial 5
Co-authored-by: Ole Kröger <[email protected]>

* Final check v0.3 (#281)

* Removed SubAction and checked for Rel/BackgroundAction
* fixed all references
* added line to changelog
* finished v0.3
Co-authored-by: Ole Kröger <[email protected]>

* format

* Taming and link to change

* changed SubAction name to Action

* removed prints

Co-authored-by: Jacob Zelko <[email protected]>
  • Loading branch information
Wikunia and TheCedarPrince authored Nov 10, 2020
1 parent 599f1c9 commit 88a57ce
Show file tree
Hide file tree
Showing 81 changed files with 3,489 additions and 10,851 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Javis.jl - Changelog

## v0.3 (10th of November 2020)
- Morphing with several shapes
- Changed `Action` to `Object` syntax
- Ability to use `setopactity()` in an `Action`
- Ability to disable an `Action` after its last defined frame. See `? Action` and the keyword `; keep`
- Moved from `Translation`, `Scaling` and `Rotation` to `anim_translate` etc
- Changed `Rel` to `RFrames` and added `GFrames` for defining actions with global frames
- A warning is shown if some frames don't have a background
- A warning is shown if an `Action` is defined outside the parental `Object`

## v0.2.2 (20th of October 2020)
- Ability to change a keyword using `change`

Expand Down
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Javis"
uuid = "78b212ba-a7f9-42d4-b726-60726080707e"
authors = ["Ole Kröger <[email protected]>", "Jacob Zelko <[email protected]>"]
version = "0.2.2"
version = "0.3.0"

[deps]
Animations = "27a7e980-b3e6-11e9-2bcd-0b925532e340"
Expand All @@ -10,12 +10,14 @@ ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
FFMPEG = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
Gtk = "4c0ca9eb-093a-5379-98c5-f87ac0bbbf44"
GtkReactive = "27996c0f-39cd-5cc1-a27a-05f136f946b6"
Hungarian = "e91730f6-4275-51fb-a7a0-7064cfbd3b39"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
LightXML = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
Luxor = "ae8d54c2-7ccd-5906-9d76-62fc9837b5bc"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
VideoIO = "d6d074c3-1acf-5d4c-9a43-ef38773959a2"

[compat]
Expand All @@ -25,6 +27,7 @@ ColorTypes = "0.10"
FFMPEG = "0.3, 0.4"
Gtk = "1.1"
GtkReactive = "1.0.3"
Hungarian = "0.6"
Images = "0.20, 0.21, 0.22, 0.23"
LaTeXStrings = "1.1"
LightXML = "0.9"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Check out our [documentation](https://wikunia.github.io/Javis.jl/dev/) for tutor
| Animation | Animation
|------------------------------------------------|------------------------------------------------|
| ![](examples/gifs/follow_bezier_path.gif) | ![](examples/gifs/julia_logo_dft.gif) |
| [Follow a Path](/examples/follow_path.jl) | [Draw the Julia Logo](/examples/julia_logo.jl) |
| [Follow a Path](/examples/follow_path.jl) | [Draw the Julia Logo](/examples/fourier.jl) |

## Installation

Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
Animations = "27a7e980-b3e6-11e9-2bcd-0b925532e340"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Hungarian = "e91730f6-4275-51fb-a7a0-7064cfbd3b39"
Javis = "78b212ba-a7f9-42d4-b726-60726080707e"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
LightXML = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
Expand Down
Binary file modified docs/src/assets/julia_logo_dft.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/src/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ If you have an interesting example that you would like to share with us, open an
| Example | Link | Details |
|------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ![](assets/follow_bezier_path.gif) | [Follow a Path](https://github.com/Wikunia/Javis.jl/blob/master/examples/follow_path.jl) | This creates a bezier curve to draw the outline of a car and have a circle go around that outlined path. [`follow_path`](@ref), `makebezierpath`, and [`appear`](@ref) were used to create this animation. |
| ![](assets/julia_logo_dft.gif) | [Draw the Julia Logo](https://github.com/Wikunia/Javis.jl/blob/master/examples/julia_logo.jl) | Drawing the Julia logo using Fourier series approximation. [`FFTW`](https://github.com/JuliaMath/FFTW.jl) and [`OffsetArrays`](https://github.com/JuliaArrays/OffsetArrays.jl) were used to make the signal transforms easier. **You must download [julia_logo.csv](https://github.com/Wikunia/Javis.jl/blob/master/examples/julia_logo.csv) for this example.** Kindly provided by [ric-cioffi](https://github.com/ric-cioffi) |
| ![](assets/julia_logo_dft.gif) | [Draw the Julia Logo](https://github.com/Wikunia/Javis.jl/blob/master/examples/fourier.jl) | Drawing the Julia logo using Fourier series approximation. It uses the libraries FFTW, FFTViews and TravelingSalesmanHeuristics. Inspired by [ric-cioffi](https://github.com/ric-cioffi) |

114 changes: 49 additions & 65 deletions docs/src/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,24 @@ function ground(args...)
end

video = Video(500, 500)
Background(1:100, ground)
# The provided snippets!

javis(video, [
BackgroundAction(1:100, ground),
SNIPPETS_GO_HERE # Replace this line with the provided snippet!
]; pathname="how_to.gif")
render(video; pathname="how_to.gif")
```

Each of the code snippets should replace the variable `SNIPPETS_GO_HERE`.

## How can I move a circle from A to B?

First of all you need to define an [`Action`](@ref) which draws a circle.
First of all you need to define an [`Object`](@ref) which draws a circle.

```julia
Action(1:100, (args...)->circle(O, 50, :fill))
circ = Object(1:100, (args...)->circle(O, 50, :fill))
```

and then you need the [`Translation`](@ref) command to move the circle.
and then you need the a translation with [`anim_translate`](@ref) to move the circle.

```julia
Action(1:100, (args...)->circle(O, 50, :fill), Translation(O, Point(100, 100)))
act!(circ, Action(anim_translate(O, Point(100, 100))))
```

The circle then moves from the origin (center of frame) 100 px down and to the right.
Expand All @@ -45,17 +42,17 @@ The simplest one is to define the `UnitRange` like `1:100` as above such that th

**Examples:**
```julia
Action(1:100, (args...)->circle(O, 50, :fill)),
Action(1:50, (args...)->circle(O, 70, :stroke))
Object(1:100, (args...)->circle(O, 50, :fill))
Object(1:50, (args...)->circle(O, 70, :stroke))
```

It is relatively often the case that the following action should work with the same frames as the previous action this can be done with.

**Examples:**
```julia
Action(1:100, (args...)->circle(O, 50, :fill)),
Action(:same, (args...)->circle(Point(100, 100), 20, :stroke)),
Action((args...)->circle(Point(-100, 100), 20, :stroke))
Object(1:100, (args...)->circle(O, 50, :fill))
Object(:same, (args...)->circle(O, 20, :stroke), Point(100, 100))
Object((args...)->circle(O, 20, :stroke), Point(-100, 100))
```

so either use the symbol `:same` or just don't mention frames.
Expand All @@ -64,40 +61,39 @@ The last option is to define frames relative to the previous frame. More precise

**Examples:**
```julia
Action(1:50, (args...)->circle(O, 50, :fill)),
Action(Rel(1:50), (args...)->circle(Point(100, 100), 20, :stroke)),
Object(1:50, (args...)->circle(O, 50, :fill))
Object(RFrames(1:50), (args...)->circle(O, 20, :stroke), Point(100, 100))
```

This is the same as:
```julia
Action(1:50, (args...)->circle(O, 50, :fill)),
Action(51:100, (args...)->circle(Point(100, 100), 20, :stroke)),
Object(1:50, (args...)->circle(O, 50, :fill))
Object(51:100, (args...)->circle(O, 20, :stroke), Point(100, 100))
```

## How can I make an object fade in from the background?

Let's make the standard circle we used before appear from the background.

```julia
Action(1:100, (args...)->circle(O, 50, :fill); subactions=[
SubAction(1:50, appear(:fade))
]),
circ = Object(1:100, (args...)->circle(O, 50, :fill))
act!(circ, Action(1:50, appear(:fade)))
```

this is using a change in opacity to show the circle.

There are two other options `:scale` and `:fade_line_width`. `:scale` also works for every kind of [`Action`](@ref) whereas `:fade_line_width` only works if you only draw the stroke instead of using fill.
There are two other options `:scale` and `:fade_line_width`. `:scale` also works for every kind of [`Object`](@ref) whereas `:fade_line_width` only works if you only draw the stroke instead of using fill.

**Example:**
```julia
Action(1:100, (args...)->circle(O, 50, :stroke); subactions=[
SubAction(1:50, appear(:fade_line_width))
]),
circ = Object(1:100, (args...)->circle(O, 50, :stroke))
act!(circ, Action(1:50, appear(:fade_line_width)))
```

Additionally you can use all of these three options for the [`disappear`](@ref) functionality.

> **NOTE:** A [`SubAction`](@ref) gets also called for frames after the last specified subaction frame such that disappeared objects stay disappeared.
> **NOTE:** An [`Action`](@ref) gets also called for frames after the last specified action frame such that disappeared objects stay disappeared.
> This can be turned off by using `; keep = false` as an argument to the [`Action`](@ref).
## How can I move one object based on another object?

Expand All @@ -111,15 +107,16 @@ end
```

Now we define two actions:
1. Drawing a circle and saving the position inside `:my_circle`
1. Drawing a circle and saving the position `my_circle`
2. Drawing a rectangle above the circle

```julia
Action(1:100, :my_circle, (args...)->circ(O, 50, :stroke), Translation(Point(100,100))),
Action(1:100, (args...)->rect(pos(:my_circle)+Point(-10, -100), 20, 20, :fill))
my_circle = Object(1:100, (args...)->circ(O, 50, :stroke))
act!(my_circle, Action(anim_translate(100, 100)))
Object(1:100, (args...)->rect(pos(my_circle)+Point(-10, -100), 20, 20, :fill))
```

In this animation the position of the circle is saved inside `:my_circle` and can be used with `pos(:my_circle)` inside the `rect` function.
In this animation the position of the circle is saved inside `my_circle` and can be used with `pos(my_circle)` inside the `rect` function.

## How can I show a text being drawn?

Expand All @@ -128,14 +125,9 @@ A `text` or [`latex`](@ref) rendering can appear as *any* other object with `app

You can use
```julia
Action(
1:100,
(args...) -> text("Hello World!"; halign = :center);
subactions = [
SubAction(1:15, sineio(), appear(:draw_text)),
SubAction(76:100, sineio(), disappear(:draw_text)),
]
)
my_text = Object(1:100, (args...) -> text("Hello World!"; halign = :center))
act!(my_text, Action(1:15, sineio(), appear(:draw_text)))
act!(my_text, Action(76:100, sineio(), disappear(:draw_text)))
```

to let the text `"Hello World!"` appear from left to right in an animated way.
Expand All @@ -148,13 +140,8 @@ All objects that return a list of points can be used directly like `star` and `p
An action can look like this:

```julia
Action(
1:150
(args...) -> star(O, 20, 5, 0.5, 0, :fill);
subactions = [
SubAction(1:150, follow_path(star(O, 300))),
],
)
my_star = Object(1:100, (args...) -> star(O, 20, 5, 0.5, 0, :fill))
act!(my_star, Action(1:100, follow_path(star(O, 200))))
```

in this case a star is following the path of a bigger star.
Expand All @@ -177,39 +164,36 @@ function luxor2poly(func::Function)
end

video = Video(600, 400)
javis(video, [
BackgroundAction(1:150, ground),
Action(
1:150,
(args...) -> star(O, 20, 5, 0.5, 0, :fill);
subactions = [
SubAction(1:150, follow_path(luxor2poly(()->rect(O, 100, 100, :path))))
]
)
]; pathname="follow_path.gif")
Background(1:100, ground)
my_star = Object(1:100, (args...) -> star(O, 20, 5, 0.5, 0, :fill))
act!(my_star, Action(1:100, follow_path(luxor2poly(()->rect(O, 100, 100, :path)))))
render(video; pathname="follow_path.gif")
```


Another possibility is to specify a vector of points like this:

```julia
Action(
1:150
(args...) -> star(O, 20, 5, 0.5, 0, :fill);
subactions = [
SubAction(1:150, sineio(), follow_path([Point(100, 200), Point(-20, -250), Point(-80, -10)]; closed=false)),
],
act!(
my_star,
Action(
1:100,
sineio(),
follow_path([Point(100, 100), Point(-20, -150), Point(-80, -10)]; closed = false),
),
)
```

In this case I want the star to follow a path consisting of two edges and I use `; closed=false` to specify that it's just two edges and not a closed triangle.

An interesting possibility is to define paths using Bézier curves which can be defined with Luxor see: [Polygons to Bézier paths and back again](https://juliagraphics.github.io/Luxor.jl/stable/polygons/#Polygons-to-B%C3%A9zier-paths-and-back-again)
An interesting possibility is to define paths using Bézier curves which can be defined with Luxor (see: [Polygons to Bézier paths and back again](https://juliagraphics.github.io/Luxor.jl/stable/polygons/#Polygons-to-B%C3%A9zier-paths-and-back-again))

One example of this can be seen in our [example section](examples.md)

## How can I see a live view of the animation?

A live view of the animation can be useful for creating an animation where one doesn't need the overhead of building a gif or mp4 all the time. It also has the advantage that it's very easy to jump to a specific frame.

The live viewer can be called with adding `; liveview=true` to the [`javis`](@ref) call.
The live viewer can be called with adding `; liveview=true` to the [`render`](@ref) call.

> **NOTE:** If `liveview=true` the `tempdirectory` and `pathname` arguments are ignored.
> **NOTE:** If `liveview=true` the `tempdirectory` and `pathname` arguments are ignored and no file is created.
4 changes: 2 additions & 2 deletions docs/src/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Currently, these tutorials are available:
- [**Tutorial 1: Making Your First `Javis` Animation!**](tutorials/tutorial_1.md) - a step by step guide to making your first animation with `Javis`.
- [**Tutorial 2: What Are Actions?**](tutorials/tutorial_2.md) - an introduction to the most important part of `Javis` - the `Action` object.
- [**Tutorial 3: Rendering `LaTeX` with `Javis`!**](tutorials/tutorial_3.md) - a simple tutorial on how to render `LaTeX` in `Javis` animations.
- [**Tutorial 4: Do You Know Our Mascot? Learn about Transitions and SubActions!**](tutorials/tutorial_4.md) - a fun tutorial to make our mascot and learn about the `SubAction` and `Transition` type methods.
- [**Tutorial 5: Taming the Elements**](tutorials/tutorial_5.md) - how to use `Scaling` to grow or shrink arbitrary objects and using `Javis` with other Julia packages.
- [**Tutorial 4: Do You Know Our Mascot? Learn about Transitions and Actions!**](tutorials/tutorial_4.md) - a fun tutorial to make our mascot and learn about the `Action` and `Transition` type methods.
- [**Tutorial 5: Taming the Elements**](tutorials/tutorial_5.md) - how to use `change` to grow or shrink arbitrary objects and using `Javis` with other Julia packages.
- [**Tutorial 6: Using Animations.jl to Create something with more Pep!**](tutorials/tutorial_6.md) - an advanced tutorial to make your animations more interesting.

If you spot an issue with any of these tutorials, please let us know! Thank you!
Binary file modified docs/src/tutorials/assets/atomic.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/tutorials/assets/blank_atom_scaling.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/tutorials/assets/boring_matrix.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/tutorials/assets/flaming_matrix.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/tutorials/assets/jarvis.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/src/tutorials/assets/min_atomic_info.gif
Binary file not shown.
Binary file modified docs/src/tutorials/assets/multiple_circles.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 88a57ce

Please sign in to comment.