Skip to content

Commit

Permalink
V0.2 (#196)
Browse files Browse the repository at this point in the history
* Wik feature progressmeter (#137)

* Merged the latest master into v0.2
* Using ProgressMeter

* VideoIO to render mp4 without saving temp frames (#138)

* first version of VideoIO with mp4

* fixing links in documentation (#144) (#145)

* fixing links in documentation (#144)

* first version of HowTo (#142)

* Using Animations.jl (#125)

* first version of Animations.jl

* don't allow v2.5 of Luxor because of transposing (#149)

* Wik documentation howto (#148)

* made review changes for HowTo

* docstrings for structs (#150)

* Forgot to push sethue to Animations.jl (#153)

* allow sethue in Animations.jl
* allow 2.5.1 of Luxor
* added extra line for an example of `sethue`

* merge master in v0.2

* Format file for the repository

* Removing old contributing file

* Added info on dependencies and JuliaFormatter

* Revert "merge master in v0.2"

This reverts commit a853a0f.

* Revert files to a853a0f

* Tutorial animations (#157)

* Animation tutorial

* Wik feature morphing v2 (#154)

* ability to morph with fill.

* [WIP] Live Preview (#119)

* Starting proof of concept on live preview

* Reverted Javis.jl to previous formatting

* Began work on proof of concept

* Beginning of the javis image viewer

* Continued work on trying to preview images

* Barebones example of GTK image viewer

* get_javis_frame function

* Added compat for images and updated authors

* Proof of concept javis viewer signal emission

* Temporary fix for Image compat

* Added buttons and todos

* Added functionality for buttons

* Fixed up Project TOML for compat with Images

* Fixed merge conflict logic bug

* Got proof of concept of live viewer working

* Beginning clean up of javis image viewer

* Added ColorTypes and color conversion for frames

* Added ColorTypes dependency

* Cleaned up and adding documentation strings

* Exported get_javis_frame function

* Prepped javis viewer for full integration into Javis

* Added Gtk and GtkReactive deps

* Added liveview kwarg

* Finished prototype of javis viewer

* Updated boundaries for deps

* Clarified docstrings

* Added arrow key navigation through frames

* Updated boundaries per Ole suggestion

* Fixed up formatting for CI

* Made live rendering faster

* Added loop around functionality

* Adjusted boundaries of deps

* Increased speed of image preview display

* Functionalized repeated code snippets

* Bug in javis viewer - identification attempt

* Made javis viewer work completely

* Reversion to a6fa540

* Made short circuit eval of live viewer

* Documented javis viewer thoroughly

* Added docstring

* Qualified usage of LightXML.value func

* Qualified textbox usage

* Formatting... 👀

* test with xvfb on ubuntu

* without --project

* try with project=.

* different idea using DISPLAY

* fix Documentation CI

* Added documentation for get_javis_frame

* Reduced code reuse

* Added some clarifications

* Removed export of get_javis_frame

* Changed returns for testing

* Added GtkReactive to Project

* Tests for javis_viewer

* Formatting again

* Final test case for increment/decrement tests

* Formatting test file

* Final clean up to javis viewer

Co-authored-by: Ole Kröger <[email protected]>

* removed possibility to set the fontsize inside the latex function (#180)

* removed possibility to set the fontsize inside the latex function

* ability to animate text (#162)

* ability to animate text

* Let us follow a path (#163)

* Let us follow a path

* push preview (#182)

* Update Change Log (#183)

* Added info about live viewer and javis frame

* Added info about drawing text

* Improved Action Error Msg (#185)

* Added error msg about defining Video first

* Added unit test and cleaned up code

* How To:  draw_text, follow_path and liveview (#184)

* added draw_text, follow_path and liveview in HowTo

* return 1.0 in interpolation for single frame (#188)

* [Bugfix] scaling to 0 (#191)

* don't ever scale to 0 :D

* [Bugfix] Follow path starting after first frame (#192)

* bugfix for follow_path if not on first frame

* Drafted showcase table for README

* Images for drafted showcase

* Formatted tables for showcase

* Wik examples follow path (#198)

* first version of an examples folder: drawing a car

* convert frame only once (#199)

* no need to convert to ARGB32

* refactoring (#194)

* refactoring

* merge fix renaming

* resolved typos

* Added back headers for table

* Update for Tutorial 5 (#200)

* Remove any files stored in test/images (#195)

* Remove any files stored in test/images

* Removed file check and created it as a unit test

* Unit test for test/images dir to check for additional files

* Added formatting

* Began update of tutorial 5

* Updated gifs

* Fixed gifs

* Added additional explanation on SubAction

* Merged unit with v0.2

* Added example of drawing a path

* Resized gif to 350 x 350

* fixed tutorial links in readme

* Changed compat entries to allow more (#202)

* changed compat entries to allow more

* changelog ready for merge

* Tutorial overhaul (#201)

* explaining Action and Scaling and fixing some others

* removed some "The"

* emoji fixes and some other small things

* Corrected grammar and some light editing

* Fixed some grammar issues

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

* Added Examples Page (#203)

* Added examples page link

* Added bezier path gif

* Drafted first table for examples

* Rendered examples properly

* Added explanation for example

* Fixed reference

Co-authored-by: Jacob Zelko <[email protected]>
  • Loading branch information
Wikunia and TheCedarPrince authored Sep 25, 2020
1 parent d59f1ae commit 5932888
Show file tree
Hide file tree
Showing 86 changed files with 3,334 additions and 1,050 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:
- x64
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- run: sudo apt-get install xvfb && Xvfb :99 &
if: matrix.os == 'ubuntu-latest'
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
Expand All @@ -36,6 +37,8 @@ jobs:
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
DISPLAY: :99
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
Expand All @@ -45,6 +48,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: sudo apt-get install xvfb && Xvfb :99 &
- uses: julia-actions/setup-julia@v1
with:
version: '1.4'
Expand All @@ -57,3 +61,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
DISPLAY: :99
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
Manifest.toml
.vscode/
test.png
test/current/
test/current/
.commit
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
# Javis.jl - Changelog

## 0.2.0 (25th of September 2020)
- Ability to use [Animations.jl](https://github.com/jkrumbiegel/Animations.jl)
- for Transformations and `appear` and `disappear`
- Show progress of rendering using [ProgressMeter.jl](https://github.com/timholy/ProgressMeter.jl)
- Use [VideoIO](https://github.com/JuliaIO/VideoIO.jl) for faster rendering without temporary images
- Ability to draw animated text via `appear(:draw_text)`
- Must be called inside a `SubAction`
- Ability to morph with `fill` or `stroke` and using `SubAction` to specify changes in color
- Added live viewer based on `Gtk.jl` in the `javis` function
- Activate in `javis` by setting `liveview = true`
- Prototype returning single frame of Javis animation with `get_javis_frame`
- Currently must be invoked after `javis` function call
- Can be called via `Javis.get_javis_frame` as it is not exported yet
- An object described by an action can follow a path (a vector of points). See `follow_path`
- Bugfix when scaling to 0. Before this every object on that frame would disappear even in a different layer
- Bugfix in interpolation: Interpolation of a single frame like `1:1` returns `1.0` now instead of `NaN`.


## 0.1.5 (14th of September 2020)
- Bugfix in svg parser when a layer gets both transformed and scaled

## 0.1.4 (13th of September 2020)
- Bugfix in svg parser when a reflected Bézier curve followed a move operation

### Removed
- `latex` no longer takes the `fontsize` as an argument [PR #180](https://github.com/Wikunia/Javis.jl/pull/180)

## 0.1.3 (11th of September 2020)
- First `SubAction` for an `Action` no longer requires explicit frame range and will default to the frames of the `Action`
- Ability to scale an object with `Scaling`. Works similar to `Translation` and `Rotation`
Expand Down
18 changes: 17 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
name = "Javis"
uuid = "78b212ba-a7f9-42d4-b726-60726080707e"
authors = ["Ole Kröger <[email protected]>", "Jacob Zelko <[email protected]>"]
version = "0.1.5"
version = "0.2.0"

[deps]
Animations = "27a7e980-b3e6-11e9-2bcd-0b925532e340"
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
FFMPEG = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
Gtk = "4c0ca9eb-093a-5379-98c5-f87ac0bbbf44"
GtkReactive = "27996c0f-39cd-5cc1-a27a-05f136f946b6"
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"
VideoIO = "d6d074c3-1acf-5d4c-9a43-ef38773959a2"

[compat]
Animations = "0.4"
Cairo = "1"
ColorTypes = "0.10"
FFMPEG = "0.3, 0.4"
Gtk = "1.1"
GtkReactive = "1.0.3"
Images = "0.20, 0.21, 0.22"
LaTeXStrings = "1.1"
LightXML = "0.9"
Luxor = "2"
ProgressMeter = "1"
VideoIO = "0.6, 0.7, 0.8"
julia = "1.4"
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,23 @@ Check out our [documentation](https://wikunia.github.io/Javis.jl/dev/) for tutor

## Gallery

![](assets/showcase.gif)
### Tutorials

| Animation | Animation |
|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
| ![](assets/eeg.gif) | ![](assets/dancing_circles.gif) |
| **Tutorial:** [What Are Actions?](https://wikunia.github.io/Javis.jl/stable/tutorials/tutorial_2/) | **Tutorial:** [Making Your First Javis Animation!](https://wikunia.github.io/Javis.jl/stable/tutorials/tutorial_1/) |
| ![](assets/atomic.gif) | ![](assets/jarvis.gif) |
| **Tutorial:** [Taming the Elements](https://wikunia.github.io/Javis.jl/stable/tutorials/tutorial_5/) | **Tutorial:** [Do You Know Our Mascot?](https://wikunia.github.io/Javis.jl/stable/tutorials/tutorial_4/) |
| ![](assets/matrix.gif) | ![](assets/loading.gif) |
| **Tutorial:** [Rendering LaTeX with Javis!](https://wikunia.github.io/Javis.jl/stable/tutorials/tutorial_3/) | **Tutorial:** [Using Animations.jl with Javis!](https://wikunia.github.io/Javis.jl/stable/tutorials/tutorial_6/) |

### Examples

| Animation |
|-------------------------------------------|
| ![](examples/gifs/follow_bezier_path.gif) |
| [Follow a Path](/examples/follow_path.jl) |

## Installation

Expand Down
Binary file added 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 added assets/dancing_circles.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 assets/eeg.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 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 added assets/loading.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 added assets/matrix.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[deps]
Animations = "27a7e980-b3e6-11e9-2bcd-0b925532e340"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Javis = "78b212ba-a7f9-42d4-b726-60726080707e"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Expand Down
5 changes: 4 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ makedocs(;
"tutorials/tutorial_3.md",
"tutorials/tutorial_4.md",
"tutorials/tutorial_5.md",
"tutorials/tutorial_6.md",
],
"HowTo" => "howto.md",
"Examples" => "examples.md",
"Mission" => "mission.md",
"References" => "references.md",
"Contributing" => "contributing.md",
],
)

deploydocs(; repo = "github.com/Wikunia/Javis.jl")
deploydocs(; repo = "github.com/Wikunia/Javis.jl", push_preview = true)
Binary file added docs/src/assets/follow_bezier_path.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/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Finally, click "Create pull request".
You may get some questions about it, and possibly suggestions of how to make it ready to go into the main project.
If you had test errors or problems, we are happy to help you.
Then, if all goes according to plan, it gets merged... **Thanks for the contribution!!** :tada: :tada: :tada:
Then, if all goes according to plan, it gets merged... **Thanks for the contribution!!** 🎉 🎉 🎉
## Note on Adding Dependencies
Expand Down
9 changes: 9 additions & 0 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Examples

Aside from tutorials which take you step by step on how to create a tutorial, we also felt that it useful to show additional examples on things you can make with `Javis`!
These animations do not have an accompanying tutorial but rather, scripts that you can examine, tweak, and modify to suit your own purposes.
If you have an interesting example that you would like to share with us, open an issue (check out our [Contributing Guide](contributing.md) on how to do this) and we'd be happy to add your example to this page!

| 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. |
215 changes: 215 additions & 0 deletions docs/src/howto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# How To?

This is a list of frequently ask questions answering basic "How to do X, Y, Z?" questions.

For all the questions below you need to start with:

```julia
using Javis

function ground(args...)
background("black")
sethue("white")
end

video = Video(500, 500)

javis(video, [
BackgroundAction(1:100, ground),
SNIPPETS_GO_HERE # Replace this line with the provided snippet!
]; 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.

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

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

```julia
Action(1:100, (args...)->circle(O, 50, :fill), Translation(O, Point(100, 100))
```
The circle then moves from the origin (center of frame) 100 px down and to the right.
## How can I define frames?
There are currently three different ways to define frames inside Javis.
The simplest one is to define the `UnitRange` like `1:100` as above such that the action is called for every frame from `1` to `100`.
**Examples:**
```julia
Action(1:100, (args...)->circle(O, 50, :fill)),
Action(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))
```
so either use the symbol `:same` or just don't mention frames.
The last option is to define frames relative to the previous frame. More precisely the end of the last frame.
**Examples:**
```julia
Action(1:50, (args...)->circle(O, 50, :fill)),
Action(Rel(1:50), (args...)->circle(Point(100, 100), 20, :stroke)),
```
This is the same as:
```julia
Action(1:50, (args...)->circle(O, 50, :fill)),
Action(51:100, (args...)->circle(Point(100, 100), 20, :stroke)),
```
## 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))
]),
```
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.
**Example:**
```julia
Action(1:100, (args...)->circle(O, 50, :stroke); subactions=[
SubAction(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.
## How can I move one object based on another object?
In this case we need to define our own `circ` function which draws the circle and returns the center point of the circle.
```julia
function circ(point, radius, action)
circle(point, radius, action)
return point
end
```
Now we define two actions:
1. Drawing a circle and saving the position inside `: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))
```
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?
A `text` can appear as *any* other object with `appear(:fade)` and `appear(:scale)`, However, it also has a special [`appear`](@ref) functionality called
`:draw_text`.
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)),
]
)
```
to let the text `"Hello World!"` appear from left to right in an animated way.
## How can I have an object follow a path?
We need to create a path by providing a list of points that the object can follow.
All objects that return a list of points can be used directly like `star` and `poly` for others a list of points must be provided as the input.
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))),
],
)
```
in this case a star is following the path of a bigger star.
> **NOTE:** the star inside [`follow_path`](@ref) should have the `action=:none` which is the default for most Luxor functions.
> **NOTE:** Unfortunately the above currently only works for some Luxor functions like `ngon` and `star` but not for `circle` and `rect` as they return `true` instead of the points.
In that case you need to define a function like:
```julia
function ground(args...)
background("white")
sethue("black")
end

function luxor2poly(func::Function)
newpath()
func()
closepath()
return pathtopoly()[1]
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")
```
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)),
],
)
```
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)
## 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.
> **NOTE:** If `liveview=true` the `tempdirectory` and `pathname` arguments are ignored.
Loading

0 comments on commit 5932888

Please sign in to comment.