├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── project-info.gradle └── publishing.gradle ├── resources ├── img │ ├── screenshot-macos.jpg │ └── screenshot-macos-initial-prototype.jpg └── native │ └── windows │ └── x64 │ ├── msvcp140.dll │ ├── vcomp140.dll │ ├── vccorlib140.dll │ └── vcruntime140.dll ├── settings.gradle ├── sample-servers ├── playground │ └── key-evt-sample │ │ ├── src │ │ └── main │ │ │ ├── headers │ │ │ └── keyeventwidget.h │ │ │ └── cpp │ │ │ ├── keyeventwidget.cpp │ │ │ └── main.cpp │ │ └── CMakeLists.txt ├── sample-server │ ├── .gitignore │ ├── CMakeLists.txt │ └── src │ │ └── main │ │ └── cpp │ │ └── main.cpp └── nativefx-qt │ ├── src │ └── main │ │ ├── cpp │ │ ├── __macos__disable_appnap.cpp │ │ └── vfxwebpage.cpp │ │ └── headers │ │ └── vfxwebpage.h │ └── CMakeLists.txt ├── src ├── main │ ├── java │ │ ├── animatefx │ │ │ ├── animation │ │ │ │ ├── AnimateFXInterpolator.java │ │ │ │ ├── FadeIn.java │ │ │ │ ├── FadeOut.java │ │ │ │ ├── SlideInUp.java │ │ │ │ ├── SlideInDown.java │ │ │ │ ├── SlideInLeft.java │ │ │ │ ├── SlideInRight.java │ │ │ │ ├── SlideOutUp.java │ │ │ │ ├── SlideOutDown.java │ │ │ │ ├── SlideOutLeft.java │ │ │ │ ├── SlideOutRight.java │ │ │ │ ├── FadeInDownBig.java │ │ │ │ ├── FadeInLeftBig.java │ │ │ │ ├── FadeInLeft.java │ │ │ │ ├── FadeInUpBig.java │ │ │ │ ├── FadeInDown.java │ │ │ │ ├── FadeInRightBig.java │ │ │ │ ├── FadeInUp.java │ │ │ │ ├── FadeInRight.java │ │ │ │ ├── RotateIn.java │ │ │ │ ├── FadeOutUpBig.java │ │ │ │ ├── FadeOutLeftBig.java │ │ │ │ ├── FadeOutDownBig.java │ │ │ │ ├── FadeOutRightBig.java │ │ │ │ ├── FadeOutLeft.java │ │ │ │ ├── FadeOutDown.java │ │ │ │ ├── FadeOutUp.java │ │ │ │ ├── FadeOutRight.java │ │ │ │ ├── RotateOut.java │ │ │ │ ├── RollIn.java │ │ │ │ ├── RotateInUpLeft.java │ │ │ │ ├── RotateInDownLeft.java │ │ │ │ ├── RotateInUpRight.java │ │ │ │ ├── RotateOutUpLeft.java │ │ │ │ ├── RotateInDownRight.java │ │ │ │ ├── BounceOutLeft.java │ │ │ │ ├── BounceOutRight.java │ │ │ │ ├── Flash.java │ │ │ │ ├── RotateOutUpRight.java │ │ │ │ ├── RotateOutDownRight.java │ │ │ │ ├── RotateOutDownLeft.java │ │ │ │ ├── RollOut.java │ │ │ │ ├── ZoomIn.java │ │ │ │ ├── BounceOutUp.java │ │ │ │ ├── FlipOutX.java │ │ │ │ ├── FlipOutY.java │ │ │ │ ├── GlowText.java │ │ │ │ ├── LightSpeedOut.java │ │ │ │ ├── BounceOutDown.java │ │ │ │ ├── Pulse.java │ │ │ │ ├── ZoomOut.java │ │ │ │ ├── Swing.java │ │ │ │ ├── BounceInDown.java │ │ │ │ ├── BounceOut.java │ │ │ │ ├── FlipInY.java │ │ │ │ ├── FlipInX.java │ │ │ │ ├── JackInTheBox.java │ │ │ │ ├── BounceInUp.java │ │ │ │ ├── BounceInLeft.java │ │ │ │ ├── BounceInRight.java │ │ │ │ ├── LightSpeedIn.java │ │ │ │ ├── Bounce.java │ │ │ │ ├── Hinge.java │ │ │ │ ├── ZoomOutUp.java │ │ │ │ ├── ZoomOutLeft.java │ │ │ │ ├── ZoomOutDown.java │ │ │ │ ├── ZoomOutRight.java │ │ │ │ ├── Shake.java │ │ │ │ ├── Jello.java │ │ │ │ ├── Flip.java │ │ │ │ ├── ZoomInDown.java │ │ │ │ ├── ZoomInUp.java │ │ │ │ ├── ZoomInLeft.java │ │ │ │ ├── ZoomInRight.java │ │ │ │ ├── Wobble.java │ │ │ │ ├── BounceIn.java │ │ │ │ ├── GlowBackground.java │ │ │ │ ├── RubberBand.java │ │ │ │ ├── AnimationFX.java │ │ │ │ └── Tada.java │ │ │ └── util │ │ │ │ ├── ParallelAnimationFX.java │ │ │ │ └── SequentialAnimationFX.java │ │ └── eu │ │ │ └── mihosoft │ │ │ └── nativefx │ │ │ ├── NativeEventListener.java │ │ │ └── NativeFXApp.java │ └── native │ │ ├── CMakeLists.txt │ │ └── src │ │ └── main │ │ └── headers │ │ └── jnitypeconverter.h └── test │ └── java │ └── eu │ └── mihosoft │ └── nativefx │ └── NativeBindingTest.java ├── .gitignore ├── .travis.yml ├── azure-pipelines ├── build.yml ├── dev64.ps1 ├── build-job-unix.yml └── build-job-windows.yml ├── config └── HEADER └── gradlew.bat /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miho/NativeFX/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /resources/img/screenshot-macos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miho/NativeFX/HEAD/resources/img/screenshot-macos.jpg -------------------------------------------------------------------------------- /resources/native/windows/x64/msvcp140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miho/NativeFX/HEAD/resources/native/windows/x64/msvcp140.dll -------------------------------------------------------------------------------- /resources/native/windows/x64/vcomp140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miho/NativeFX/HEAD/resources/native/windows/x64/vcomp140.dll -------------------------------------------------------------------------------- /resources/native/windows/x64/vccorlib140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miho/NativeFX/HEAD/resources/native/windows/x64/vccorlib140.dll -------------------------------------------------------------------------------- /resources/native/windows/x64/vcruntime140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miho/NativeFX/HEAD/resources/native/windows/x64/vcruntime140.dll -------------------------------------------------------------------------------- /resources/img/screenshot-macos-initial-prototype.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miho/NativeFX/HEAD/resources/img/screenshot-macos-initial-prototype.jpg -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | maven { 5 | url "https://oss.sonatype.org/content/repositories/snapshots/" 6 | } 7 | } 8 | } 9 | 10 | rootProject.name = 'NativeFX' 11 | 12 | -------------------------------------------------------------------------------- /sample-servers/playground/key-evt-sample/src/main/headers/keyeventwidget.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class KeyEventWidget : public QWidget { 6 | Q_OBJECT 7 | 8 | public: 9 | KeyEventWidget( QWidget *parent = 0, const char *name = 0 ); 10 | ~KeyEventWidget() {} 11 | bool eventFilter(QObject *obj, QEvent *ev); 12 | }; -------------------------------------------------------------------------------- /sample-servers/sample-server/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | .gradle 8 | .vscode 9 | .project 10 | .classpath 11 | .settings/ 12 | 13 | /bin/ 14 | /src/main/native/ext/ 15 | /src/main/native/src/main/headers/eu_mihosoft_nativefx_NativeBinding.h 16 | 17 | /src/main/resources/eu/mihosoft/nativefx/nativelibs/ 18 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/AnimateFXInterpolator.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | 5 | public final class AnimateFXInterpolator { 6 | 7 | private AnimateFXInterpolator() { 8 | throw new IllegalStateException("AnimateFX Interpolator"); 9 | } 10 | 11 | public static final Interpolator EASE = Interpolator.SPLINE(0.25, 0.1, 0.25, 1); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sample-servers/nativefx-qt/src/main/cpp/__macos__disable_appnap.cpp: -------------------------------------------------------------------------------- 1 | #ifdef __APPLE__ 2 | #import 3 | #import 4 | void __macos__disable_app_nap(void) { 5 | if ([[NSProcessInfo processInfo] respondsToSelector:@selector(beginActivityWithOptions:reason:)]){ 6 | [[NSProcessInfo processInfo] beginActivityWithOptions:0x00FFFFFF reason:@"No, I don't want to nap!"]; 7 | } 8 | } 9 | #endif // __APPLE__ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | build_me 7 | 8 | /deps/ 9 | 10 | .gradle 11 | .vscode 12 | .project 13 | .classpath 14 | .settings 15 | 16 | /bin/ 17 | /src/main/native/ext/ 18 | /src/main/native/src/main/headers/eu_mihosoft_nativefx_NativeBinding.h 19 | 20 | /src/main/resources/eu/mihosoft/nativefx/nativelibs/ 21 | 22 | /hs_err*.log 23 | 24 | .idea/ 25 | -------------------------------------------------------------------------------- /sample-servers/playground/key-evt-sample/src/main/cpp/keyeventwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "keyeventwidget.h" 2 | 3 | #include 4 | #include 5 | 6 | KeyEventWidget::KeyEventWidget(QWidget *parent, const char *name) {} 7 | 8 | bool KeyEventWidget::eventFilter(QObject *obj, QEvent *ev) { 9 | 10 | if(ev->type() == QEvent::KeyPress) { 11 | QKeyEvent* kev = (QKeyEvent*)ev; 12 | std::cout << "key: " << kev->key() << std::endl; 13 | } 14 | 15 | return false; 16 | } -------------------------------------------------------------------------------- /sample-servers/playground/key-evt-sample/src/main/cpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "keyeventwidget.h" 6 | 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | // create qapplication before touching any other qobject/class 11 | QApplication app(argc, argv, false); 12 | 13 | KeyEventWidget window; 14 | window.setFixedSize(120, 50); 15 | 16 | window.installEventFilter(&window); 17 | 18 | QPushButton *button = new QPushButton("Hello World", &window); 19 | button->setGeometry(10, 10, 100, 30); 20 | 21 | window.show(); 22 | 23 | // qapplication does its magic... 24 | int exec_result = app.exec(); 25 | 26 | return exec_result; 27 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | addons: 4 | apt: 5 | packages: 6 | - make 7 | - cmake-data 8 | - cmake 9 | 10 | env: 11 | - TERM=dumb 12 | 13 | matrix: 14 | include: 15 | - os: linux 16 | language: java 17 | jdk: openjdk11 18 | install: true 19 | - os: linux 20 | language: java 21 | jdk: openjdk12 22 | install: true 23 | - os: osx 24 | language: java 25 | jdk: openjdk11 26 | install: true 27 | - os: osx 28 | language: java 29 | jdk: openjdk12 30 | install: true 31 | 32 | #cache: 33 | # ccache: true 34 | # directories: 35 | # - /Users/travis/build/miho/ 36 | 37 | before_script: 38 | - sh ./gradlew clean assemble 39 | script: 40 | - export CWD=$(pwd) 41 | - sh ./gradlew test 42 | -------------------------------------------------------------------------------- /azure-pipelines/build.yml: -------------------------------------------------------------------------------- 1 | # Get Azure Pipelines free plan 2 | # Visit https://azure.microsoft.com/en-us/services/devops/pipelines/ 3 | 4 | trigger: 5 | - master 6 | 7 | jobs: 8 | 9 | # Linux job 10 | 11 | - template: ./build-job-unix.yml 12 | parameters: 13 | name: Linux_JDK_11 14 | platform: linux 15 | jdkVersion: 1.11 16 | pool: 17 | vmImage: 'ubuntu-16.04' 18 | 19 | # Mac OS job 20 | 21 | - template: ./build-job-unix.yml 22 | parameters: 23 | name: MacOS_JDK_11 24 | platform: mac 25 | jdkVersion: 1.11 26 | pool: 27 | vmImage: 'macOS-10.13' 28 | 29 | 30 | # Windows job 31 | 32 | - template: build-job-windows.yml 33 | parameters: 34 | name: Windows_JDK_11 35 | platform: win 36 | jdkVersion: 1.11 37 | pool: 38 | vmImage: 'windows-2019' 39 | -------------------------------------------------------------------------------- /azure-pipelines/dev64.ps1: -------------------------------------------------------------------------------- 1 | Function dev64 { 2 | 3 | # http://evandontje.com/2013/06/06/emulate-the-visual-studio-command-prompt-in-powershell/ 4 | # Move to the directory where vcvarsall.bat is stored 5 | #pushd "$env:VS140COMNTOOLS\..\..\VC" 6 | pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools" 7 | # Call the .bat file to set the variables in a temporary cmd session and use 'set' to read out all session variables and pipe them into a foreach to iterate over each variable 8 | cmd /c "VsDevCmd.bat -arch=amd64 -host_arch=amd64 &set" | foreach { 9 | # if the line is a session variable 10 | if( $_ -match "=" ) 11 | { 12 | $pair = $_.split("="); 13 | 14 | # Set the environment variable for the current PowerShell session 15 | Set-Item -Force -Path "ENV:\$($pair[0])" -Value "$($pair[1])" 16 | } 17 | } 18 | 19 | # Move back to wherever the prompt was previously 20 | popd 21 | 22 | } 23 | 24 | dev64 -------------------------------------------------------------------------------- /sample-servers/sample-server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # at least cmake 3.9 is required to build this project 2 | cmake_minimum_required(VERSION 3.9) 3 | 4 | project(sample-server) 5 | 6 | # this project relies on C++11 7 | set(CMAKE_CXX_STANDARD 11) 8 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 9 | set(CMAKE_CXX_EXTENSIONS OFF) 10 | 11 | # library sources 12 | set(SOURCES 13 | src/main/cpp/main.cpp 14 | ) 15 | 16 | set(CMAKE_BUILD_TYPE DEBUG) 17 | 18 | include_directories("../ext/headers/") 19 | include_directories("../../src/main/native/ext/headers/") 20 | include_directories("../headers/") 21 | include_directories("./src/main/headers/") 22 | 23 | # create an executable 24 | add_executable(sample-server ${SOURCES}) 25 | 26 | # todo: is there a better way to detect linux? 27 | if(UNIX AND NOT APPLE) 28 | set(LINUX TRUE) 29 | endif() 30 | 31 | if(LINUX) 32 | target_link_libraries(sample-server rt pthread) 33 | endif() 34 | 35 | #target_link_libraries (nativefx libname) 36 | 37 | -------------------------------------------------------------------------------- /config/HEADER: -------------------------------------------------------------------------------- 1 | Copyright ${yearSince1}-${yearCurrent} ${author1}. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | If you use this software for scientific research then please cite the following publication(s): 16 | 17 | M. Hoffer, C. Poliwoda, & G. Wittum. (2013). Visual reflection library: 18 | a framework for declarative GUI programming on the Java platform. 19 | Computing and Visualization in Science, 2013, 16(4), 20 | 181–192. http://doi.org/10.1007/s00791-014-0230-y -------------------------------------------------------------------------------- /azure-pipelines/build-job-unix.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | name: '' 3 | pool: '' 4 | platform: '' 5 | jdkVersion: '1.11' 6 | gradleWrapperFile: 'gradlew.bat' 7 | workingDirectory: '' 8 | tasks: 'clean assemble test' 9 | 10 | jobs: 11 | - job: '__${{ parameters.name }}__' 12 | pool: ${{ parameters.pool }} 13 | steps: 14 | - task: Gradle@2 15 | inputs: 16 | gradleWrapperFile: './gradlew' 17 | workingDirectory: './' 18 | javaHomeOption: 'JDKVersion' 19 | jdkVersionOption: ${{ parameters.jdkVersion }} 20 | jdkArchitectureOption: 'x64' 21 | #publishJUnitResults: true 22 | #testResultsFiles: '**/TEST-*.xml' 23 | tasks: 'clean assemble' 24 | - task: Gradle@2 25 | inputs: 26 | gradleWrapperFile: './gradlew' 27 | workingDirectory: './' 28 | javaHomeOption: 'JDKVersion' 29 | jdkVersionOption: ${{ parameters.jdkVersion }} 30 | jdkArchitectureOption: 'x64' 31 | publishJUnitResults: true 32 | testResultsFiles: '**/TEST-*.xml' 33 | tasks: 'test' 34 | -------------------------------------------------------------------------------- /azure-pipelines/build-job-windows.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | name: '' 3 | pool: '' 4 | platform: '' 5 | jdkVersion: '1.11' 6 | gradleWrapperFile: 'gradlew.bat' 7 | workingDirectory: '' 8 | tasks: 'clean assemble test' 9 | 10 | jobs: 11 | - job: '__${{ parameters.name }}__' 12 | pool: ${{ parameters.pool }} 13 | steps: 14 | - task: Gradle@2 15 | inputs: 16 | gradleWrapperFile: './gradlew' 17 | workingDirectory: './' 18 | javaHomeOption: 'JDKVersion' 19 | jdkVersionOption: ${{ parameters.jdkVersion }} 20 | jdkArchitectureOption: 'x64' 21 | #publishJUnitResults: true 22 | #testResultsFiles: '**/TEST-*.xml' 23 | tasks: 'clean assemble' 24 | - task: Gradle@2 25 | inputs: 26 | gradleWrapperFile: './gradlew' 27 | workingDirectory: './' 28 | javaHomeOption: 'JDKVersion' 29 | jdkVersionOption: ${{ parameters.jdkVersion }} 30 | jdkArchitectureOption: 'x64' 31 | publishJUnitResults: true 32 | testResultsFiles: '**/TEST-*.xml' 33 | tasks: 'test' 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/main/native/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # at least cmake 3.9 is required to build this project 2 | cmake_minimum_required(VERSION 3.9) 3 | 4 | project(nativefx) 5 | 6 | # this project relies on C++11 7 | set(CMAKE_CXX_STANDARD 11) 8 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 9 | set(CMAKE_CXX_EXTENSIONS OFF) 10 | 11 | # library sources 12 | set(SOURCES 13 | src/main/cpp/nativefx.cpp 14 | src/main/cpp/jnitypeconverter.cpp 15 | ) 16 | 17 | set(CMAKE_BUILD_TYPE RELEASE) 18 | find_package(JNI REQUIRED) 19 | include_directories(${JNI_INCLUDE_DIRS}) 20 | include_directories("src/main/headers/") 21 | include_directories("ext/headers/") 22 | 23 | # create a shared library from the sources and link it against libs. 24 | add_library(nativefx SHARED ${SOURCES}) 25 | 26 | # todo: is there a better way to detect linux? 27 | if(UNIX AND NOT APPLE) 28 | set(LINUX TRUE) 29 | endif() 30 | 31 | if(LINUX) 32 | target_link_libraries(nativefx rt pthread) 33 | endif() 34 | 35 | message("> JNI Libs: ${JNI_LIBRARIES}") 36 | #target_link_libraries(nativefx ${JNI_LIBRARIES}) 37 | #target_link_libraries (nativefx libname) 38 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeIn.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | /** 10 | * @author Loïc Sculier aka typhon0 11 | */ 12 | 13 | public class FadeIn extends AnimationFX { 14 | 15 | /** 16 | * Create a new FadeIn animation 17 | * 18 | * @param node the node to affect 19 | */ 20 | public FadeIn(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeIn() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | new KeyFrame(Duration.millis(0), 36 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 37 | ), 38 | new KeyFrame(Duration.millis(1000), 39 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 40 | ) 41 | 42 | )); 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeOut.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | /** 10 | * @author Loïc Sculier aka typhon0 11 | */ 12 | public class FadeOut extends AnimationFX { 13 | /** 14 | * Create a new FadeOut animation 15 | * @param node the node to affect 16 | */ 17 | public FadeOut(Node node) { 18 | super(node); 19 | } 20 | 21 | public FadeOut() { 22 | } 23 | 24 | @Override 25 | AnimationFX resetNode() { 26 | getNode().setOpacity(1); 27 | return this; 28 | } 29 | 30 | @Override 31 | void initTimeline() { 32 | setTimeline(new Timeline( 33 | new KeyFrame(Duration.millis(0), 34 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 35 | ), 36 | new KeyFrame(Duration.millis(1000), 37 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 38 | ) 39 | )); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/SlideInUp.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class SlideInUp extends AnimationFX { 14 | 15 | /** 16 | * Create new SlideInUp 17 | * 18 | * @param node The node to affect 19 | */ 20 | public SlideInUp(Node node) { 21 | super(node); 22 | } 23 | 24 | public SlideInUp() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().translateYProperty(), getNode().getBoundsInParent().getHeight(), AnimateFXInterpolator.EASE) 38 | ), 39 | new KeyFrame(Duration.millis(1000), 40 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 41 | ) 42 | )); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/SlideInDown.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class SlideInDown extends AnimationFX { 14 | 15 | /** 16 | * Create new SlideInDown 17 | * 18 | * @param node The node to affect 19 | */ 20 | public SlideInDown(Node node) { 21 | super(node); 22 | } 23 | 24 | public SlideInDown() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | new KeyFrame(Duration.millis(0), 36 | new KeyValue(getNode().translateYProperty(), -getNode().getBoundsInParent().getHeight(), AnimateFXInterpolator.EASE) 37 | ), 38 | new KeyFrame(Duration.millis(1000), 39 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 40 | ) 41 | )); 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/SlideInLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class SlideInLeft extends AnimationFX { 14 | 15 | /** 16 | * Create new SlideInLeft 17 | * 18 | * @param node The node to affect 19 | */ 20 | public SlideInLeft(Node node) { 21 | super(node); 22 | } 23 | 24 | public SlideInLeft() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | new KeyFrame(Duration.millis(0), 36 | new KeyValue(getNode().translateXProperty(), -getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE) 37 | ), 38 | new KeyFrame(Duration.millis(1000), 39 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 40 | ) 41 | )); 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/SlideInRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class SlideInRight extends AnimationFX { 14 | 15 | /** 16 | * Create new SlideInRight 17 | * 18 | * @param node The node to affect 19 | */ 20 | public SlideInRight(Node node) { 21 | super(node); 22 | } 23 | 24 | public SlideInRight() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().translateXProperty(), getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE) 38 | ), 39 | new KeyFrame(Duration.millis(1000), 40 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 41 | ) 42 | )); 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/main/java/eu/mihosoft/nativefx/NativeEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2019 Michael Hoffer . All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * If you use this software for scientific research then please cite the following publication(s): 17 | * 18 | * M. Hoffer, C. Poliwoda, & G. Wittum. (2013). Visual reflection library: 19 | * a framework for declarative GUI programming on the Java platform. 20 | * Computing and Visualization in Science, 2013, 16(4), 21 | * 181–192. http://doi.org/10.1007/s00791-014-0230-y 22 | */ 23 | package eu.mihosoft.nativefx; 24 | 25 | @FunctionalInterface 26 | public interface NativeEventListener { 27 | void event(int key, String type, String evt); 28 | } -------------------------------------------------------------------------------- /sample-servers/nativefx-qt/src/main/headers/vfxwebpage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | class VFXWebPage : public QWebEngineView 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | VFXWebPage(); 18 | 19 | void set_redraw_callback(std::function redraw_callback); 20 | 21 | void set_native_event_callback(std::function native_evt_callback); 22 | 23 | void request_redraw(QImage* img); 24 | 25 | void sendSimulatedEvent(QEvent *evt); 26 | 27 | //@override 28 | bool event(QEvent * ev); 29 | 30 | protected: 31 | 32 | // virtual void mouseMoveEvent(QMouseEvent *event); 33 | 34 | void paintEvent(QPaintEvent * event); 35 | 36 | bool eventFilter(QObject *obj, QEvent *ev); 37 | 38 | //@override 39 | virtual void childEvent(QChildEvent *event); 40 | 41 | private: 42 | QPointer child_; 43 | QImage* image; 44 | bool dirty; 45 | std::function redraw_callback; 46 | QWidget* eventsReciverWidget; 47 | 48 | signals: 49 | void delegatePaint(QPaintEvent*); 50 | }; 51 | 52 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/SlideOutUp.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class SlideOutUp extends AnimationFX { 14 | 15 | /** 16 | * Create new SlideOutUp 17 | * 18 | * @param node The node to affect 19 | */ 20 | public SlideOutUp(Node node) { 21 | super(node); 22 | } 23 | 24 | public SlideOutUp() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateY(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 39 | ), 40 | new KeyFrame(Duration.millis(1000), 41 | new KeyValue(getNode().translateYProperty(), -getNode().getBoundsInParent().getHeight(), AnimateFXInterpolator.EASE) 42 | ) 43 | )); 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/SlideOutDown.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class SlideOutDown extends AnimationFX { 14 | 15 | /** 16 | * Create new SlideOutDown 17 | * 18 | * @param node The node to affect 19 | */ 20 | public SlideOutDown(Node node) { 21 | super(node); 22 | } 23 | 24 | public SlideOutDown() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateY(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline( new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 39 | ), 40 | new KeyFrame(Duration.millis(1000), 41 | new KeyValue(getNode().translateYProperty(), getNode().getBoundsInParent().getHeight(), AnimateFXInterpolator.EASE) 42 | ) 43 | )); 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/SlideOutLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class SlideOutLeft extends AnimationFX { 14 | 15 | /** 16 | * Create new SlideOutLeft 17 | * 18 | * @param node The node to affect 19 | */ 20 | public SlideOutLeft(Node node) { 21 | super(node); 22 | } 23 | 24 | public SlideOutLeft() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateX(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 39 | ), 40 | new KeyFrame(Duration.millis(1000), 41 | new KeyValue(getNode().translateXProperty(), -getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE) 42 | ) 43 | )); 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/SlideOutRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class SlideOutRight extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeOutLeft 17 | * 18 | * @param node The node to affect 19 | */ 20 | public SlideOutRight(Node node) { 21 | super(node); 22 | } 23 | 24 | public SlideOutRight() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateX(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 39 | ), 40 | new KeyFrame(Duration.millis(1000), 41 | new KeyValue(getNode().translateXProperty(), getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE) 42 | ) 43 | )); 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeInDownBig.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeInDownBig extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeInDownBig 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeInDownBig(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeInDownBig() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | new KeyFrame(Duration.millis(0), 36 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 37 | new KeyValue(getNode().translateYProperty(), -2000, AnimateFXInterpolator.EASE) 38 | ), 39 | 40 | new KeyFrame(Duration.millis(1000), 41 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 43 | ) 44 | )); 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeInLeftBig.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeInLeftBig extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeInLeftBig 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeInLeftBig(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeInLeftBig() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 38 | new KeyValue(getNode().translateXProperty(), -2000, AnimateFXInterpolator.EASE) 39 | ), 40 | new KeyFrame(Duration.millis(1000), 41 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 43 | ) 44 | )); 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /gradle/project-info.gradle: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // publishing information 3 | // ----------------------------------------------------------------------------- 4 | ext.publishing.artifactId = project.name.toLowerCase() 5 | ext.publishing.groupId = 'eu.mihosoft.nativefx' 6 | ext.publishing.versionId = '0.2.1' 7 | 8 | ext.publishing.developerName = 'Michael Hoffer' 9 | ext.publishing.developerAlias = 'miho' 10 | ext.publishing.developerEmail = 'info@michaelhoffer.de' 11 | ext.publishing.inceptionYear = '2019' 12 | 13 | ext.publishing.bintray.repo = 'NativeFX' 14 | ext.publishing.bintray.userOrg = 'miho' 15 | ext.publishing.bintray.name = project.name 16 | 17 | ext.publishing.desc = 'Native rendering for JavaFX via shared memory.' 18 | ext.publishing.license = 'Apache-2.0' 19 | ext.publishing.licenseUrl = 'https://github.com/miho/NativeFX/blob/master/LICENSE' 20 | ext.publishing.labels = ['nativefx', 'javafx', 'native rendering', 'shared memory'] 21 | ext.publishing.websiteUrl = 'https://github.com/miho/NativeFX' 22 | ext.publishing.issueTrackerUrl = 'https://github.com/miho/NativeFX/issues' 23 | ext.publishing.vcsUrl = 'https://github.com/miho/NativeFX.git' 24 | 25 | ext.publishing.pomName = ext.publishing.artifactId 26 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeInLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeInLeft extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeInLeft 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeInLeft(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeInLeft() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | new KeyFrame(Duration.millis(0), 36 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 37 | new KeyValue(getNode().translateXProperty(), -getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE) 38 | ), 39 | new KeyFrame(Duration.millis(1000), 40 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 41 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 42 | ) 43 | )); 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeInUpBig.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeInUpBig extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeInUpBig 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeInUpBig(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeInUpBig() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 38 | new KeyValue(getNode().translateYProperty(), 2000, AnimateFXInterpolator.EASE) 39 | 40 | ), 41 | new KeyFrame(Duration.millis(1000), 42 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 44 | 45 | ) 46 | 47 | )); 48 | } 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeInDown.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeInDown extends AnimationFX{ 14 | 15 | /** 16 | * Create new FadeInDown 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeInDown(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeInDown() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | new KeyFrame(Duration.millis(0), 36 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 37 | new KeyValue(getNode().translateYProperty(), -getNode().getBoundsInParent().getHeight(), AnimateFXInterpolator.EASE) 38 | ), 39 | 40 | new KeyFrame(Duration.millis(1000), 41 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 43 | ) 44 | )); 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeInRightBig.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeInRightBig extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeInRightBig 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeInRightBig(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeInRightBig() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 38 | new KeyValue(getNode().translateXProperty(), 2000, AnimateFXInterpolator.EASE) 39 | 40 | ), 41 | new KeyFrame(Duration.millis(1000), 42 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 44 | ) 45 | )); 46 | } 47 | 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeInUp.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeInUp extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeInUp 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeInUp(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeInUp() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().translateYProperty(), getNode().getBoundsInParent().getHeight(), AnimateFXInterpolator.EASE) 40 | 41 | ), 42 | new KeyFrame(Duration.millis(1000), 43 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 45 | 46 | ) 47 | 48 | )); 49 | } 50 | 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeInRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeInRight extends AnimationFX{ 14 | 15 | /** 16 | * Create new FadeInRight 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeInRight(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeInRight() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 38 | new KeyValue(getNode().translateXProperty(), getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE) 39 | 40 | ), 41 | new KeyFrame(Duration.millis(1000), 42 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 44 | 45 | ) 46 | 47 | )); 48 | } 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RotateIn.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RotateIn extends AnimationFX { 14 | 15 | /** 16 | * Create new RotateIn 17 | * 18 | * @param node The node to affect 19 | */ 20 | public RotateIn(Node node) { 21 | super(node); 22 | } 23 | 24 | public RotateIn() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | getNode().setRotationAxis(Rotate.Z_AXIS); 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().rotateProperty(), -200, AnimateFXInterpolator.EASE), 38 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 39 | ), 40 | new KeyFrame(Duration.millis(1000), 41 | new KeyValue(getNode().rotateProperty(), 0, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 43 | ) 44 | )); 45 | } 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeOutUpBig.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeOutUpBig extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeOutUpBig 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeOutUpBig(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeOutUpBig() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateY(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 40 | ), 41 | new KeyFrame(Duration.millis(1000), 42 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().translateYProperty(), -2000, AnimateFXInterpolator.EASE) 44 | ) 45 | )); 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeOutLeftBig.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeOutLeftBig extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeOutLeftBig 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeOutLeftBig(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeOutLeftBig() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateX(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 40 | ), 41 | new KeyFrame(Duration.millis(1000), 42 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().translateXProperty(), -2000, AnimateFXInterpolator.EASE) 44 | ) 45 | )); 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeOutDownBig.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeOutDownBig extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeOutDown 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeOutDownBig(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeOutDownBig() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateY(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 40 | ), 41 | new KeyFrame(Duration.millis(1000), 42 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().translateYProperty(), 2000, AnimateFXInterpolator.EASE) 44 | ) 45 | )); 46 | } 47 | 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeOutRightBig.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeOutRightBig extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeOutRightBig 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeOutRightBig(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeOutRightBig() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateX(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 40 | ), 41 | new KeyFrame(Duration.millis(1000), 42 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().translateXProperty(), 2000, AnimateFXInterpolator.EASE) 44 | ) 45 | )); 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeOutLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeOutLeft extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeOutLeft 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeOutLeft(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeOutLeft() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateX(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 40 | ), 41 | new KeyFrame(Duration.millis(1000), 42 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().translateXProperty(), -getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE) 44 | ) 45 | )); 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeOutDown.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeOutDown extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeOutDown 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeOutDown(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeOutDown() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateY(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 40 | ), 41 | new KeyFrame(Duration.millis(1000), 42 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().translateYProperty(), getNode().getBoundsInParent().getHeight(), AnimateFXInterpolator.EASE) 44 | ) 45 | )); 46 | } 47 | 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeOutUp.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeOutUp extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeOutUp 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeOutUp(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeOutUp() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateY(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) 40 | 41 | ), 42 | new KeyFrame(Duration.millis(1000), 43 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().translateYProperty(), -getNode().getBoundsInParent().getHeight(), AnimateFXInterpolator.EASE) 45 | 46 | ) 47 | )); 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FadeOutRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class FadeOutRight extends AnimationFX { 14 | 15 | /** 16 | * Create new FadeOutLeft 17 | * 18 | * @param node The node to affect 19 | */ 20 | public FadeOutRight(Node node) { 21 | super(node); 22 | } 23 | 24 | public FadeOutRight() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateX(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 40 | 41 | ), 42 | new KeyFrame(Duration.millis(1000), 43 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().translateXProperty(), getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE) 45 | 46 | ) 47 | )); 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RotateOut.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RotateOut extends AnimationFX { 14 | 15 | /** 16 | * Create new RotateOut 17 | * 18 | * @param node The node to affect 19 | */ 20 | public RotateOut(Node node) { 21 | super(node); 22 | } 23 | 24 | public RotateOut() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setRotate(0); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | getNode().setRotationAxis(Rotate.Z_AXIS); 37 | setTimeline(new Timeline( 38 | new KeyFrame(Duration.millis(0), 39 | new KeyValue(getNode().rotateProperty(), 0, AnimateFXInterpolator.EASE), 40 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 41 | ), 42 | new KeyFrame(Duration.millis(1000), 43 | new KeyValue(getNode().rotateProperty(), 200, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 45 | ) 46 | )); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RollIn.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RollIn extends AnimationFX { 14 | 15 | /** 16 | * Create new RollIn 17 | * 18 | * @param node The node to affect 19 | */ 20 | public RollIn(Node node) { 21 | super(node); 22 | } 23 | 24 | public RollIn() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | new KeyFrame(Duration.millis(0), 36 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 37 | new KeyValue(getNode().translateXProperty(), -getNode().getBoundsInLocal().getWidth(), AnimateFXInterpolator.EASE), 38 | new KeyValue(getNode().rotateProperty(), -120, AnimateFXInterpolator.EASE) 39 | ), 40 | new KeyFrame(Duration.millis(1000), 41 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().rotateProperty(), 0, AnimateFXInterpolator.EASE) 44 | ) 45 | )); 46 | } 47 | 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RotateInUpLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RotateInUpLeft extends AnimationFX { 14 | 15 | /** 16 | * Create new RotateInDownLeft 17 | * 18 | * @param node The node to affect 19 | */ 20 | public RotateInUpLeft(Node node) { 21 | super(node); 22 | } 23 | 24 | public RotateInUpLeft() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | getNode().setRotationAxis(Rotate.Z_AXIS); 35 | Rotate rotate = new Rotate(0, 0, getNode().getBoundsInLocal().getHeight()); 36 | getNode().getTransforms().add(rotate); 37 | setTimeline(new Timeline( 38 | new KeyFrame(Duration.millis(0), 39 | new KeyValue(rotate.angleProperty(), 45, AnimateFXInterpolator.EASE), 40 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 41 | ), 42 | new KeyFrame(Duration.millis(1000), 43 | new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 45 | ) 46 | )); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RotateInDownLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RotateInDownLeft extends AnimationFX { 14 | 15 | /** 16 | * Create new RotateInDownLeft 17 | * 18 | * @param node The node to affect 19 | */ 20 | public RotateInDownLeft(Node node) { 21 | super(node); 22 | } 23 | 24 | public RotateInDownLeft() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | getNode().setRotationAxis(Rotate.Z_AXIS); 36 | Rotate rotate = new Rotate(0, 0, getNode().getBoundsInLocal().getHeight()); 37 | getNode().getTransforms().add(rotate); 38 | setTimeline(new Timeline( 39 | new KeyFrame(Duration.millis(0), 40 | new KeyValue(rotate.angleProperty(), -45, AnimateFXInterpolator.EASE), 41 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 42 | ), 43 | new KeyFrame(Duration.millis(1000), 44 | new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 46 | ) 47 | )); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /sample-servers/playground/key-evt-sample/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.9) 2 | 3 | project(key-evt-sample) 4 | 5 | # this project relies on C++11 6 | set(CMAKE_CXX_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 8 | set(CMAKE_CXX_EXTENSIONS OFF) 9 | 10 | set(CMAKE_AUTOMOC ON) 11 | set(CMAKE_AUTORCC ON) 12 | set(CMAKE_AUTOUIC ON) 13 | 14 | find_package(Qt5 COMPONENTS Widgets REQUIRED) 15 | 16 | include_directories(./src/main/headers) 17 | 18 | 19 | set(SOURCES 20 | ./src/main/cpp/main.cpp 21 | 22 | ./src/main/headers/keyeventwidget.h 23 | ./src/main/cpp/keyeventwidget.cpp 24 | ) 25 | 26 | # this whole section is just to force macos not to put our server into 27 | # appnap mode 28 | # 29 | # we treat the __macos__disable_appnap.cpp as mm file (objective-cpp) 30 | # and tell the os to leave us alone 31 | if(APPLE) 32 | set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-framework Cocoa") 33 | set( TREAT_AS_OBJCPP "-x objective-c++") 34 | foreach(SRC ${SOURCES}) 35 | if(${SRC} MATCHES __macos__disable_appnap.cpp$) 36 | set_source_files_properties( 37 | ${CMAKE_CURRENT_SOURCE_DIR}/${SRC} 38 | PROPERTIES 39 | COMPILE_FLAGS 40 | "${TREAT_AS_OBJCPP}") 41 | endif() 42 | endforeach(SRC) 43 | endif() 44 | 45 | add_executable(key-evt-sample ${SOURCES}) 46 | 47 | # todo: is there a better way to detect linux? 48 | if(UNIX AND NOT APPLE) 49 | set(LINUX TRUE) 50 | endif() 51 | 52 | if(LINUX) 53 | target_link_libraries(key-evt-sample Qt5::Widgets) 54 | else() 55 | target_link_libraries(key-evt-sample Qt5::Widgets) 56 | endif() 57 | 58 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RotateInUpRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RotateInUpRight extends AnimationFX { 14 | 15 | /** 16 | * Create new RotateInUpRight 17 | * 18 | * @param node The node to affect 19 | */ 20 | public RotateInUpRight(Node node) { 21 | super(node); 22 | } 23 | 24 | public RotateInUpRight() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | getNode().setRotationAxis(Rotate.Z_AXIS); 35 | Rotate rotate = new Rotate(0, getNode().getBoundsInLocal().getWidth(), getNode().getBoundsInLocal().getHeight()); 36 | getNode().getTransforms().add(rotate); 37 | setTimeline(new Timeline( 38 | new KeyFrame(Duration.millis(0), 39 | new KeyValue(rotate.angleProperty(), -45, AnimateFXInterpolator.EASE), 40 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 41 | ), 42 | new KeyFrame(Duration.millis(1000), 43 | new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 45 | ) 46 | )); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RotateOutUpLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RotateOutUpLeft extends AnimationFX { 14 | 15 | private Rotate rotate; 16 | /** 17 | * Create new RotateOutUpLeft 18 | * 19 | * @param node The node to affect 20 | */ 21 | public RotateOutUpLeft(Node node) { 22 | super(node); 23 | } 24 | 25 | public RotateOutUpLeft() { 26 | } 27 | 28 | @Override 29 | AnimationFX resetNode() { 30 | getNode().setOpacity(1); 31 | rotate.setAngle(0); 32 | return this; 33 | } 34 | 35 | @Override 36 | void initTimeline() { 37 | rotate = new Rotate(0, 0, getNode().getBoundsInLocal().getHeight()); 38 | getNode().getTransforms().add(rotate); 39 | setTimeline(new Timeline( 40 | new KeyFrame(Duration.millis(0), 41 | new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 43 | ), 44 | new KeyFrame(Duration.millis(1000), 45 | new KeyValue(rotate.angleProperty(), -45, AnimateFXInterpolator.EASE), 46 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 47 | ) 48 | )); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RotateInDownRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RotateInDownRight extends AnimationFX { 14 | 15 | /** 16 | * Create new RotateInDownRight 17 | * 18 | * @param node The node to affect 19 | */ 20 | public RotateInDownRight(Node node) { 21 | super(node); 22 | } 23 | 24 | public RotateInDownRight() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | getNode().setRotationAxis(Rotate.Z_AXIS); 36 | Rotate rotate = new Rotate(0, getNode().getBoundsInLocal().getWidth(), getNode().getBoundsInLocal().getHeight()); 37 | getNode().getTransforms().add(rotate); 38 | setTimeline(new Timeline( 39 | new KeyFrame(Duration.millis(0), 40 | new KeyValue(rotate.angleProperty(), 45, AnimateFXInterpolator.EASE), 41 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 42 | ), 43 | new KeyFrame(Duration.millis(1000), 44 | new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 46 | ) 47 | )); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/BounceOutLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | /** 10 | * @author Loïc Sculier aka typhon0 11 | */ 12 | public class BounceOutLeft extends AnimationFX { 13 | 14 | /** 15 | * Create new BounceOutLeft animation 16 | * 17 | * @param node The node to affect 18 | */ 19 | public BounceOutLeft(final Node node) { 20 | super(node); 21 | } 22 | 23 | public BounceOutLeft() { 24 | } 25 | 26 | @Override 27 | AnimationFX resetNode() { 28 | getNode().setTranslateX(0); 29 | getNode().setOpacity(1); 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 38 | ), 39 | new KeyFrame(Duration.millis(200), 40 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 41 | new KeyValue(getNode().translateXProperty(), 20, AnimateFXInterpolator.EASE) 42 | ), 43 | new KeyFrame(Duration.millis(1000), 44 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().translateXProperty(), -2000, AnimateFXInterpolator.EASE) 46 | ) 47 | 48 | )); 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/BounceOutRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | /** 10 | * @author Loïc Sculier aka typhon0 11 | */ 12 | public class BounceOutRight extends AnimationFX { 13 | 14 | /** 15 | * Create new BounceOutRight animation 16 | * 17 | * @param node The node to affect 18 | */ 19 | public BounceOutRight(final Node node) { 20 | super(node); 21 | } 22 | 23 | public BounceOutRight() { 24 | } 25 | 26 | @Override 27 | AnimationFX resetNode() { 28 | getNode().setTranslateX(0); 29 | getNode().setOpacity(1); 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 38 | ), 39 | new KeyFrame(Duration.millis(200), 40 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 41 | new KeyValue(getNode().translateXProperty(), -20, AnimateFXInterpolator.EASE) 42 | ), 43 | new KeyFrame(Duration.millis(1000), 44 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().translateXProperty(), 2000, AnimateFXInterpolator.EASE) 46 | ) 47 | )); 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/Flash.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class Flash extends AnimationFX { 14 | 15 | /** 16 | * Create new Flash 17 | * 18 | * @param node The node to affect 19 | */ 20 | public Flash(Node node) { 21 | super(node); 22 | } 23 | 24 | public Flash() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 39 | ), 40 | new KeyFrame(Duration.millis(250), 41 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 42 | ), 43 | new KeyFrame(Duration.millis(500), 44 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 45 | ), 46 | new KeyFrame(Duration.millis(750), 47 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 48 | ), 49 | new KeyFrame(Duration.millis(1000), 50 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 51 | ) 52 | 53 | )); 54 | } 55 | 56 | } 57 | 58 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RotateOutUpRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RotateOutUpRight extends AnimationFX { 14 | 15 | private Rotate rotate; 16 | 17 | /** 18 | * Create new RotateOutUpRight 19 | * 20 | * @param node The node to affect 21 | */ 22 | public RotateOutUpRight(Node node) { 23 | super(node); 24 | } 25 | 26 | public RotateOutUpRight() { 27 | } 28 | 29 | @Override 30 | AnimationFX resetNode() { 31 | getNode().setOpacity(1); 32 | rotate.setAngle(0); 33 | return this; 34 | } 35 | 36 | @Override 37 | void initTimeline() { 38 | rotate = new Rotate(0, getNode().getBoundsInLocal().getWidth(), getNode().getBoundsInLocal().getHeight()); 39 | getNode().getTransforms().add(rotate); 40 | setTimeline(new Timeline( 41 | new KeyFrame(Duration.millis(0), 42 | new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 44 | ), 45 | new KeyFrame(Duration.millis(1000), 46 | new KeyValue(rotate.angleProperty(), 45, AnimateFXInterpolator.EASE), 47 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 48 | ) 49 | )); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RotateOutDownRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RotateOutDownRight extends AnimationFX { 14 | 15 | private Rotate rotate; 16 | 17 | /** 18 | * Create new RotateOutDownRight 19 | * 20 | * @param node The node to affect 21 | */ 22 | public RotateOutDownRight(Node node) { 23 | super(node); 24 | } 25 | 26 | public RotateOutDownRight() { 27 | } 28 | 29 | @Override 30 | AnimationFX resetNode() { 31 | getNode().setOpacity(1); 32 | rotate.setAngle(0); 33 | return this; 34 | } 35 | 36 | @Override 37 | void initTimeline() { 38 | rotate = new Rotate(0, getNode().getBoundsInLocal().getWidth(), getNode().getBoundsInLocal().getHeight()); 39 | getNode().getTransforms().add(rotate); 40 | setTimeline(new Timeline( 41 | new KeyFrame(Duration.millis(0), 42 | new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 44 | ), 45 | new KeyFrame(Duration.millis(1000), 46 | new KeyValue(rotate.angleProperty(), -45, AnimateFXInterpolator.EASE), 47 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 48 | ) 49 | )); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RotateOutDownLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RotateOutDownLeft extends AnimationFX { 14 | 15 | private Rotate rotate; 16 | 17 | /** 18 | * Create new RotateOutDownLeft 19 | * 20 | * @param node The node to affect 21 | */ 22 | public RotateOutDownLeft(Node node) { 23 | super(node); 24 | } 25 | 26 | public RotateOutDownLeft() { 27 | } 28 | 29 | @Override 30 | AnimationFX resetNode() { 31 | getNode().setOpacity(1); 32 | rotate.setAngle(0); 33 | return this; 34 | } 35 | 36 | @Override 37 | void initTimeline() { 38 | getNode().setRotationAxis(Rotate.Z_AXIS); 39 | rotate = new Rotate(0, 0, getNode().getBoundsInLocal().getHeight()); 40 | getNode().getTransforms().add(rotate); 41 | setTimeline(new Timeline( 42 | new KeyFrame(Duration.millis(0), 43 | new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 45 | ), 46 | new KeyFrame(Duration.millis(1000), 47 | new KeyValue(rotate.angleProperty(), 45, AnimateFXInterpolator.EASE), 48 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 49 | ) 50 | )); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RollOut.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class RollOut extends AnimationFX { 14 | 15 | /** 16 | * Create new RollOut 17 | * 18 | * @param node The node to affect 19 | */ 20 | public RollOut(Node node) { 21 | super(node); 22 | } 23 | 24 | public RollOut() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setTranslateX(0); 31 | getNode().setRotate(0); 32 | return this; 33 | } 34 | 35 | @Override 36 | void initTimeline() { 37 | setTimeline(new Timeline( 38 | new KeyFrame(Duration.millis(0), 39 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 40 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE), 41 | new KeyValue(getNode().rotateProperty(), 0, AnimateFXInterpolator.EASE) 42 | ), 43 | new KeyFrame(Duration.millis(1000), 44 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().translateXProperty(), getNode().getBoundsInLocal().getWidth(), AnimateFXInterpolator.EASE), 46 | new KeyValue(getNode().rotateProperty(), 120, AnimateFXInterpolator.EASE) 47 | ) 48 | )); 49 | } 50 | 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/ZoomIn.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class ZoomIn extends AnimationFX { 14 | 15 | /** 16 | * Create new ZoomIn 17 | * 18 | * @param node The node to affect 19 | */ 20 | public ZoomIn(Node node) { 21 | super(node); 22 | } 23 | 24 | public ZoomIn() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 38 | new KeyValue(getNode().scaleXProperty(), 0.3, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().scaleYProperty(), 0.3, AnimateFXInterpolator.EASE), 40 | new KeyValue(getNode().scaleZProperty(), 0.3, AnimateFXInterpolator.EASE) 41 | ), 42 | new KeyFrame(Duration.millis(1000), 43 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 46 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 47 | ) 48 | )); 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/BounceOutUp.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | /** 10 | * @author Loïc Sculier aka typhon0 11 | */ 12 | public class BounceOutUp extends AnimationFX { 13 | 14 | /** 15 | * Create new BounceOutUp animation 16 | * 17 | * @param node The node to affect 18 | */ 19 | public BounceOutUp(final Node node) { 20 | super(node); 21 | } 22 | 23 | public BounceOutUp() { 24 | } 25 | 26 | @Override 27 | AnimationFX resetNode() { 28 | getNode().setTranslateY(0); 29 | getNode().setOpacity(1); 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 38 | ), 39 | new KeyFrame(Duration.millis(200), 40 | new KeyValue(getNode().translateYProperty(), -10, AnimateFXInterpolator.EASE) 41 | ), 42 | new KeyFrame(Duration.millis(400), 43 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().translateYProperty(), 20, AnimateFXInterpolator.EASE) 45 | ), 46 | new KeyFrame(Duration.millis(1000), 47 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 48 | new KeyValue(getNode().translateYProperty(), -2000, AnimateFXInterpolator.EASE) 49 | ) 50 | )); 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /sample-servers/nativefx-qt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.9) 2 | 3 | project(nativefx-qt) 4 | 5 | # this project relies on C++11 6 | set(CMAKE_CXX_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 8 | set(CMAKE_CXX_EXTENSIONS OFF) 9 | 10 | set(CMAKE_AUTOMOC ON) 11 | set(CMAKE_AUTORCC ON) 12 | set(CMAKE_AUTOUIC ON) 13 | 14 | find_package(Qt5 COMPONENTS Widgets WebEngine WebEngineWidgets REQUIRED) 15 | 16 | include_directories("../ext/headers/") 17 | include_directories("../../src/main/native/ext/headers/") 18 | include_directories("../headers/") 19 | include_directories("./src/main/headers/") 20 | 21 | set(SOURCES 22 | ./src/main/cpp/main.cpp 23 | ./src/main/cpp/vfxwebpage.cpp 24 | ./src/main/cpp/__macos__disable_appnap.cpp 25 | ./src/main/headers/vfxwebpage.h 26 | ) 27 | 28 | # this whole section is just to force macos not to put our server into 29 | # appnap mode 30 | # 31 | # we treat the __macos__disable_appnap.cpp as mm file (objective-cpp) 32 | # and tell the os to leave us alone 33 | if(APPLE) 34 | set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-framework Cocoa") 35 | set( TREAT_AS_OBJCPP "-x objective-c++") 36 | foreach(SRC ${SOURCES}) 37 | if(${SRC} MATCHES __macos__disable_appnap.cpp$) 38 | set_source_files_properties( 39 | ${CMAKE_CURRENT_SOURCE_DIR}/${SRC} 40 | PROPERTIES 41 | COMPILE_FLAGS 42 | "${TREAT_AS_OBJCPP}") 43 | endif() 44 | endforeach(SRC) 45 | endif() 46 | 47 | add_executable(nativefx-qt ${SOURCES}) 48 | 49 | # todo: is there a better way to detect linux? 50 | if(UNIX AND NOT APPLE) 51 | set(LINUX TRUE) 52 | endif() 53 | 54 | if(LINUX) 55 | target_link_libraries(nativefx-qt Qt5::Widgets Qt5::WebEngine Qt5::WebEngineWidgets rt pthread) 56 | else() 57 | target_link_libraries(nativefx-qt Qt5::Widgets Qt5::WebEngine Qt5::WebEngineWidgets ) 58 | endif() 59 | 60 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FlipOutX.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.ParallelCamera; 8 | import javafx.scene.PerspectiveCamera; 9 | import javafx.util.Duration; 10 | 11 | import static javafx.scene.transform.Rotate.X_AXIS; 12 | 13 | 14 | /** 15 | * @author Loïc Sculier aka typhon0 16 | */ 17 | public class FlipOutX extends AnimationFX { 18 | 19 | /** 20 | * Create new FlipOutX 21 | * 22 | * @param node The node to affect 23 | */ 24 | public FlipOutX(Node node) { 25 | super(node); 26 | } 27 | 28 | public FlipOutX() { 29 | } 30 | 31 | @Override 32 | AnimationFX resetNode() { 33 | getNode().setOpacity(1); 34 | getNode().setRotate(0); 35 | return this; 36 | } 37 | 38 | @Override 39 | void initTimeline() { 40 | getNode().getScene().setCamera(new PerspectiveCamera()); 41 | getNode().setRotationAxis(X_AXIS); 42 | setTimeline(new Timeline( 43 | new KeyFrame(Duration.millis(0), 44 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 45 | ), 46 | new KeyFrame(Duration.millis(225), 47 | new KeyValue(getNode().rotateProperty(), 20, AnimateFXInterpolator.EASE) 48 | ), 49 | new KeyFrame(Duration.millis(750), 50 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 51 | new KeyValue(getNode().rotateProperty(), -90, AnimateFXInterpolator.EASE) 52 | ) 53 | )); 54 | getTimeline().setOnFinished(event -> getNode().getScene().setCamera(new ParallelCamera())); 55 | 56 | } 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FlipOutY.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.ParallelCamera; 8 | import javafx.scene.PerspectiveCamera; 9 | import javafx.util.Duration; 10 | 11 | import static javafx.scene.transform.Rotate.Y_AXIS; 12 | 13 | 14 | /** 15 | * @author Loïc Sculier aka typhon0 16 | */ 17 | public class FlipOutY extends AnimationFX { 18 | 19 | /** 20 | * Create new FlipOutY 21 | * 22 | * @param node The node to affect 23 | */ 24 | public FlipOutY(Node node) { 25 | super(node); 26 | } 27 | 28 | public FlipOutY() { 29 | } 30 | 31 | @Override 32 | AnimationFX resetNode() { 33 | getNode().setOpacity(1); 34 | getNode().setRotate(0); 35 | return this; 36 | } 37 | 38 | @Override 39 | void initTimeline() { 40 | getNode().getScene().setCamera(new PerspectiveCamera()); 41 | getNode().setRotationAxis(Y_AXIS); 42 | setTimeline(new Timeline( 43 | new KeyFrame(Duration.millis(0), 44 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 45 | ), 46 | new KeyFrame(Duration.millis(225), 47 | new KeyValue(getNode().rotateProperty(), 15, AnimateFXInterpolator.EASE) 48 | ), 49 | new KeyFrame(Duration.millis(750), 50 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 51 | new KeyValue(getNode().rotateProperty(), -90, AnimateFXInterpolator.EASE) 52 | ) 53 | )); 54 | getTimeline().setOnFinished(event -> getNode().getScene().setCamera(new ParallelCamera())); 55 | 56 | } 57 | 58 | 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/GlowText.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.control.Labeled; 7 | import javafx.scene.paint.Paint; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * Makes text glow alternating between two colors 12 | * 13 | * @author ced04u 14 | */ 15 | public class GlowText extends AnimationFX { 16 | 17 | private final Paint originalPaint; 18 | private final Paint colorA; 19 | private final Paint colorB; 20 | 21 | public GlowText(Labeled node, Paint colorA, Paint colorB) { 22 | super(node); 23 | this.originalPaint = getNode().textFillProperty().get(); 24 | this.colorA = colorA; 25 | this.colorB = colorB; 26 | getTimeline().getKeyFrames().addAll( 27 | new KeyFrame(Duration.millis(0), 28 | new KeyValue(getNode().textFillProperty(), colorA)), 29 | new KeyFrame(Duration.millis(500), 30 | new KeyValue(getNode().textFillProperty(), colorB)), 31 | new KeyFrame(Duration.millis(1000), 32 | new KeyValue(getNode().textFillProperty(), colorA)) 33 | ); 34 | } 35 | 36 | public GlowText(Paint originalPaint, Paint colorA, Paint colorB) { 37 | this.originalPaint = originalPaint; 38 | this.colorA = colorA; 39 | this.colorB = colorB; 40 | } 41 | 42 | @Override 43 | public Labeled getNode() { 44 | return (Labeled) super.getNode(); 45 | } 46 | 47 | @Override 48 | AnimationFX resetNode() { 49 | getNode().setTextFill(originalPaint); 50 | return this; 51 | } 52 | 53 | @Override 54 | void initTimeline() { 55 | setTimeline(new Timeline()); //will be populated at the end of constructor 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/LightSpeedOut.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.scene.transform.Shear; 9 | import javafx.util.Duration; 10 | 11 | /** 12 | * @author Sculier Loïc aka typhon0 13 | */ 14 | 15 | public class LightSpeedOut extends AnimationFX { 16 | 17 | private Shear shear; 18 | 19 | /** 20 | * Create new LightSpeedOut 21 | * 22 | * @param node The node to affect 23 | */ 24 | public LightSpeedOut(Node node) { 25 | super(node); 26 | } 27 | 28 | public LightSpeedOut() { 29 | } 30 | 31 | @Override 32 | AnimationFX resetNode() { 33 | shear.setX(0); 34 | shear.setY(0); 35 | getNode().setOpacity(1); 36 | getNode().setTranslateX(0); 37 | return this; 38 | } 39 | 40 | @Override 41 | void initTimeline() { 42 | shear = new Shear(); 43 | getNode().getTransforms().add(shear); 44 | setTimeline(new Timeline( 45 | new KeyFrame(Duration.millis(0), 46 | new KeyValue(shear.xProperty(), 0), 47 | new KeyValue(shear.yProperty(), 0), 48 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.EASE_IN) 49 | ), 50 | new KeyFrame(Duration.millis(1000), 51 | new KeyValue(getNode().translateXProperty(), getNode().getBoundsInParent().getWidth(), Interpolator.EASE_IN), 52 | new KeyValue(shear.xProperty(), 0.30), 53 | new KeyValue(shear.yProperty(), 0), 54 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.EASE_IN) 55 | ) 56 | )); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/BounceOutDown.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | /** 10 | * @author Loïc Sculier aka typhon0 11 | */ 12 | public class BounceOutDown extends AnimationFX { 13 | 14 | /** 15 | * Create new BounceOutDown animation 16 | * 17 | * @param node The node to affect 18 | */ 19 | public BounceOutDown(final Node node) { 20 | super(node); 21 | } 22 | 23 | public BounceOutDown() { 24 | } 25 | 26 | @Override 27 | AnimationFX resetNode() { 28 | getNode().setOpacity(1); 29 | getNode().setTranslateY(0); 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | double endY = getNode().getScene().getHeight() - getNode().localToScene(0, 0).getY(); 36 | setTimeline(new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 39 | ), 40 | new KeyFrame(Duration.millis(200), 41 | new KeyValue(getNode().translateYProperty(), 10, AnimateFXInterpolator.EASE) 42 | ), 43 | new KeyFrame(Duration.millis(400), 44 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().translateYProperty(), -20, AnimateFXInterpolator.EASE) 46 | ), 47 | new KeyFrame(Duration.millis(1000), 48 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 49 | new KeyValue(getNode().translateYProperty(), endY) 50 | ) 51 | )); 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/Pulse.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier 12 | */ 13 | public class Pulse extends AnimationFX { 14 | 15 | /** 16 | * Create new Pulse 17 | * 18 | * @param node The node to affect 19 | */ 20 | public Pulse(Node node) { 21 | super(node); 22 | } 23 | 24 | public Pulse() { 25 | } 26 | 27 | 28 | @Override 29 | AnimationFX resetNode() { 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 38 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 40 | ), 41 | new KeyFrame(Duration.millis(500), 42 | new KeyValue(getNode().scaleXProperty(), 1.05, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().scaleYProperty(), 1.05, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().scaleZProperty(), 1.05, AnimateFXInterpolator.EASE) 45 | ), 46 | new KeyFrame(Duration.millis(1000), 47 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 48 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 49 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 50 | ) 51 | )); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/ZoomOut.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class ZoomOut extends AnimationFX { 14 | 15 | /** 16 | * Create new ZoomOut 17 | * 18 | * @param node The node to affect 19 | */ 20 | public ZoomOut(Node node) { 21 | super(node); 22 | } 23 | 24 | public ZoomOut() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setScaleX(1); 31 | getNode().setScaleY(1); 32 | getNode().setScaleZ(1); 33 | return this; 34 | } 35 | 36 | @Override 37 | void initTimeline() { 38 | setTimeline(new Timeline( 39 | new KeyFrame(Duration.millis(0), 40 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 41 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().scaleZProperty(), 0.3, AnimateFXInterpolator.EASE) 44 | ), 45 | new KeyFrame(Duration.millis(500), 46 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 47 | new KeyValue(getNode().scaleXProperty(), 0.3, AnimateFXInterpolator.EASE), 48 | new KeyValue(getNode().scaleYProperty(), 0.3, AnimateFXInterpolator.EASE), 49 | new KeyValue(getNode().scaleZProperty(), 0.3, AnimateFXInterpolator.EASE) 50 | ), 51 | new KeyFrame(Duration.millis(1000), 52 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 53 | ) 54 | )); 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/Swing.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class Swing extends AnimationFX { 14 | 15 | /** 16 | * Create new Swing 17 | * 18 | * @param node The node to affect 19 | */ 20 | public Swing(Node node) { 21 | super(node); 22 | } 23 | 24 | public Swing() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | Rotate rotation = new Rotate(); 35 | rotation.setPivotX(getNode().getLayoutBounds().getWidth() / 2.0); 36 | rotation.setPivotY(-getNode().getLayoutBounds().getHeight()); 37 | getNode().getTransforms().add(rotation); 38 | setTimeline(new Timeline( 39 | new KeyFrame(Duration.millis(0), 40 | new KeyValue(rotation.angleProperty(), 0, AnimateFXInterpolator.EASE) 41 | ), 42 | new KeyFrame(Duration.millis(200), 43 | new KeyValue(rotation.angleProperty(), 15, AnimateFXInterpolator.EASE) 44 | ), 45 | new KeyFrame(Duration.millis(400), 46 | new KeyValue(rotation.angleProperty(), -10, AnimateFXInterpolator.EASE) 47 | ), 48 | new KeyFrame(Duration.millis(600), 49 | new KeyValue(rotation.angleProperty(), 5, AnimateFXInterpolator.EASE) 50 | ), 51 | new KeyFrame(Duration.millis(800), 52 | new KeyValue(rotation.angleProperty(), -5, AnimateFXInterpolator.EASE) 53 | ), 54 | new KeyFrame(Duration.millis(1000), 55 | new KeyValue(rotation.angleProperty(), 0, AnimateFXInterpolator.EASE) 56 | ) 57 | )); 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/BounceInDown.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class BounceInDown extends AnimationFX { 14 | 15 | /** 16 | * Create new BounceInDown animation 17 | * 18 | * @param node The node to affect 19 | */ 20 | public BounceInDown(Node node) { 21 | super(node); 22 | } 23 | 24 | public BounceInDown() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | this.setTimeline(new Timeline( 35 | 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 38 | new KeyValue(getNode().translateYProperty(), -3000, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 39 | ), 40 | new KeyFrame(Duration.millis(600), 41 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 42 | new KeyValue(getNode().translateYProperty(), 25, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 43 | ), 44 | new KeyFrame(Duration.millis(750), 45 | new KeyValue(getNode().translateYProperty(), -10, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 46 | ), 47 | new KeyFrame(Duration.millis(900), 48 | new KeyValue(getNode().translateYProperty(), 5, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 49 | ), 50 | new KeyFrame(Duration.millis(1000), 51 | new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 52 | ) 53 | )); 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/BounceOut.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | /** 10 | * @author Loïc Sculier aka typhon0 11 | */ 12 | public class BounceOut extends AnimationFX { 13 | 14 | /** 15 | * Create new BounceOut animation 16 | * 17 | * @param node The node to affect 18 | */ 19 | public BounceOut(final Node node) { 20 | super(node); 21 | } 22 | 23 | public BounceOut() { 24 | } 25 | 26 | @Override 27 | AnimationFX resetNode() { 28 | getNode().setOpacity(1); 29 | getNode().setScaleX(1); 30 | getNode().setScaleY(1); 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | setTimeline(new Timeline( 37 | 38 | new KeyFrame(Duration.millis(0), 39 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 40 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE) 41 | ), 42 | new KeyFrame(Duration.millis(200), 43 | new KeyValue(getNode().scaleXProperty(), 0.9, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().scaleYProperty(), 0.9, AnimateFXInterpolator.EASE) 45 | ), 46 | new KeyFrame(Duration.millis(550), 47 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 48 | new KeyValue(getNode().scaleXProperty(), 1.1, AnimateFXInterpolator.EASE), 49 | new KeyValue(getNode().scaleYProperty(), 1.1, AnimateFXInterpolator.EASE) 50 | ), 51 | new KeyFrame(Duration.millis(1000), 52 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 53 | new KeyValue(getNode().scaleXProperty(), 0.3, AnimateFXInterpolator.EASE), 54 | new KeyValue(getNode().scaleYProperty(), 0.3, AnimateFXInterpolator.EASE) 55 | ) 56 | 57 | )); 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FlipInY.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.scene.ParallelCamera; 9 | import javafx.scene.PerspectiveCamera; 10 | import javafx.util.Duration; 11 | 12 | import static javafx.scene.transform.Rotate.Y_AXIS; 13 | 14 | 15 | /** 16 | * @author Loïc Sculier aka typhon0 17 | */ 18 | public class FlipInY extends AnimationFX { 19 | 20 | /** 21 | * Create new FlipInY 22 | * 23 | * @param node The node to affect 24 | */ 25 | public FlipInY(Node node) { 26 | super(node); 27 | } 28 | 29 | public FlipInY() { 30 | } 31 | 32 | @Override 33 | AnimationFX resetNode() { 34 | return this; 35 | } 36 | 37 | @Override 38 | void initTimeline() { 39 | getNode().getScene().setCamera(new PerspectiveCamera()); 40 | getNode().setRotationAxis(Y_AXIS); 41 | setTimeline(new Timeline( 42 | new KeyFrame(Duration.millis(0), 43 | //new KeyValue(getNode().opacityProperty(), 0, Interpolator.EASE_IN), 44 | new KeyValue(getNode().rotateProperty(), 0, Interpolator.EASE_IN) 45 | ), 46 | new KeyFrame(Duration.millis(400), 47 | new KeyValue(getNode().rotateProperty(), 90, Interpolator.EASE_IN) 48 | 49 | ), 50 | new KeyFrame(Duration.millis(600), 51 | new KeyValue(getNode().rotateProperty(), 180, Interpolator.EASE_IN) 52 | 53 | ), 54 | new KeyFrame(Duration.millis(800), 55 | new KeyValue(getNode().rotateProperty(), 270, Interpolator.EASE_IN) 56 | ), 57 | new KeyFrame(Duration.millis(1000), 58 | //new KeyValue(getNode().opacityProperty(), 1, Interpolator.EASE_IN), 59 | new KeyValue(getNode().rotateProperty(), 360, Interpolator.EASE_IN) 60 | ) 61 | )); 62 | getTimeline().setOnFinished(event -> getNode().getScene().setCamera(new ParallelCamera())); 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/FlipInX.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.scene.ParallelCamera; 9 | import javafx.scene.PerspectiveCamera; 10 | import javafx.util.Duration; 11 | 12 | import static javafx.scene.transform.Rotate.X_AXIS; 13 | 14 | 15 | /** 16 | * @author Loïc Sculier aka typhon0 17 | */ 18 | public class FlipInX extends AnimationFX { 19 | 20 | /** 21 | * Create new FlipInX 22 | * 23 | * @param node The node to affect 24 | */ 25 | public FlipInX(Node node) { 26 | super(node); 27 | } 28 | 29 | public FlipInX() { 30 | } 31 | 32 | @Override 33 | AnimationFX resetNode() { 34 | return this; 35 | } 36 | 37 | @Override 38 | void initTimeline() { 39 | getNode().getScene().setCamera(new PerspectiveCamera()); 40 | getNode().setRotationAxis(X_AXIS); 41 | setTimeline(new Timeline( 42 | 43 | new KeyFrame(Duration.millis(0), 44 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.EASE_IN), 45 | new KeyValue(getNode().rotateProperty(), -90, Interpolator.EASE_IN) 46 | 47 | ), 48 | new KeyFrame(Duration.millis(400), 49 | new KeyValue(getNode().rotateProperty(), 20, Interpolator.EASE_IN) 50 | 51 | ), 52 | new KeyFrame(Duration.millis(600), 53 | new KeyValue(getNode().rotateProperty(), -10, Interpolator.EASE_IN) 54 | 55 | ), 56 | new KeyFrame(Duration.millis(800), 57 | new KeyValue(getNode().rotateProperty(), 5, Interpolator.EASE_IN) 58 | ), 59 | new KeyFrame(Duration.millis(1000), 60 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.EASE_IN), 61 | new KeyValue(getNode().rotateProperty(), 0, Interpolator.EASE_IN) 62 | ) 63 | 64 | )); 65 | getTimeline().setOnFinished(event -> getNode().getScene().setCamera(new ParallelCamera())); 66 | 67 | } 68 | 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/JackInTheBox.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class JackInTheBox extends AnimationFX { 14 | 15 | /** 16 | * Create new JackInTheBox animation 17 | * 18 | * @param node The node to affect 19 | */ 20 | public JackInTheBox(Node node) { 21 | super(node); 22 | 23 | } 24 | 25 | public JackInTheBox() { 26 | } 27 | 28 | @Override 29 | AnimationFX resetNode() { 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | Rotate rotate = new Rotate(30, getNode().getBoundsInParent().getWidth() / 2, getNode().getBoundsInParent().getHeight()); 36 | getNode().getTransforms().add(rotate); 37 | setTimeline(new Timeline( 38 | new KeyFrame(Duration.millis(0), 39 | new KeyValue(rotate.angleProperty(), 30, AnimateFXInterpolator.EASE), 40 | new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE), 41 | new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) 43 | ), 44 | new KeyFrame(Duration.millis(500), 45 | new KeyValue(rotate.angleProperty(), -10, AnimateFXInterpolator.EASE) 46 | ), 47 | new KeyFrame(Duration.millis(700), 48 | new KeyValue(rotate.angleProperty(), 3, AnimateFXInterpolator.EASE) 49 | ), 50 | new KeyFrame(Duration.millis(1000), 51 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 52 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 53 | new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), 54 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) 55 | ) 56 | )); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/BounceInUp.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class BounceInUp extends AnimationFX{ 14 | 15 | /** 16 | * Create new BounceInUp 17 | * 18 | * @param node The node to affect 19 | */ 20 | public BounceInUp(Node node) { 21 | super(node); 22 | } 23 | 24 | public BounceInUp() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | double startY = getNode().getScene().getHeight() - getNode().localToScene(0, 0).getY(); 35 | setTimeline( new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 38 | new KeyValue(getNode().translateYProperty(), startY, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 39 | ), 40 | new KeyFrame(Duration.millis(600), 41 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 42 | new KeyValue(getNode().translateYProperty(), -20, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 43 | ), 44 | new KeyFrame(Duration.millis(750), 45 | new KeyValue(getNode().translateYProperty(), 10, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 46 | ), 47 | new KeyFrame(Duration.millis(900), 48 | new KeyValue(getNode().translateYProperty(), -5, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 49 | ), 50 | new KeyFrame(Duration.millis(1000), 51 | new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 52 | ) 53 | 54 | )); 55 | } 56 | 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/BounceInLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class BounceInLeft extends AnimationFX { 14 | 15 | /** 16 | * Create new BounceInLeft 17 | * 18 | * @param node The node to affect 19 | */ 20 | public BounceInLeft(Node node) { 21 | super(node); 22 | } 23 | 24 | public BounceInLeft() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | double startX = -getNode().localToScene(0, 0).getX() - getNode().getBoundsInParent().getWidth(); 35 | setTimeline( 36 | new Timeline( 37 | new KeyFrame(Duration.millis(0), 38 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 39 | new KeyValue(getNode().translateXProperty(), startX, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 40 | ), 41 | new KeyFrame(Duration.millis(600), 42 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 43 | new KeyValue(getNode().translateXProperty(), 25, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 44 | ), 45 | new KeyFrame(Duration.millis(750), 46 | new KeyValue(getNode().translateXProperty(), -10, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 47 | ), 48 | new KeyFrame(Duration.millis(900), 49 | new KeyValue(getNode().translateXProperty(), 5, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 50 | ), 51 | new KeyFrame(Duration.millis(1000), 52 | new KeyValue(getNode().translateXProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 53 | ) 54 | 55 | )); 56 | } 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/BounceInRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class BounceInRight extends AnimationFX { 14 | 15 | /** 16 | * Create new BounceInRight 17 | * 18 | * @param node The node to affect 19 | */ 20 | public BounceInRight(Node node) { 21 | super(node); 22 | } 23 | 24 | public BounceInRight() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | 35 | double startX = getNode().getScene().getWidth() - getNode().localToScene(0, 0).getX(); 36 | setTimeline( 37 | new Timeline( 38 | new KeyFrame(Duration.millis(0), 39 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 40 | new KeyValue(getNode().translateXProperty(), startX, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 41 | ), 42 | new KeyFrame(Duration.millis(600), 43 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 44 | new KeyValue(getNode().translateXProperty(), -25, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 45 | ), 46 | new KeyFrame(Duration.millis(750), 47 | new KeyValue(getNode().translateXProperty(), 10, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 48 | ), 49 | new KeyFrame(Duration.millis(900), 50 | new KeyValue(getNode().translateXProperty(), -5, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 51 | ), 52 | new KeyFrame(Duration.millis(1000), 53 | new KeyValue(getNode().translateXProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 54 | ) 55 | 56 | )); 57 | 58 | } 59 | 60 | 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/LightSpeedIn.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.scene.transform.Shear; 9 | import javafx.util.Duration; 10 | 11 | /** 12 | * @author Sculier Loïc aka typhon0 13 | */ 14 | 15 | public class LightSpeedIn extends AnimationFX { 16 | /** 17 | * Create new LightSpeedIn 18 | * 19 | * @param node The node to affect 20 | */ 21 | public LightSpeedIn(Node node) { 22 | super(node); 23 | } 24 | 25 | public LightSpeedIn() { 26 | } 27 | 28 | @Override 29 | AnimationFX resetNode() { 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | Shear shear = new Shear(); 36 | getNode().getTransforms().add(shear); 37 | setTimeline(new Timeline( 38 | new KeyFrame(Duration.millis(0), 39 | new KeyValue(getNode().translateXProperty(), getNode().getBoundsInParent().getWidth(), Interpolator.EASE_OUT), 40 | new KeyValue(shear.xProperty(), -0.30), 41 | new KeyValue(shear.yProperty(), 0), 42 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.EASE_OUT) 43 | ), 44 | new KeyFrame(Duration.millis(600), 45 | new KeyValue(getNode().translateXProperty(), 0, Interpolator.EASE_OUT), 46 | 47 | new KeyValue(shear.xProperty(), 0.20), 48 | new KeyValue(shear.yProperty(), 0), 49 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.EASE_OUT) 50 | ), 51 | new KeyFrame(Duration.millis(800), 52 | 53 | new KeyValue(shear.xProperty(), -0.5), 54 | new KeyValue(shear.yProperty(), 0), 55 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.EASE_OUT) 56 | ), 57 | new KeyFrame(Duration.millis(1000), 58 | new KeyValue(shear.xProperty(), 0), 59 | new KeyValue(shear.yProperty(), 0), 60 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.EASE_OUT) 61 | ))); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/Bounce.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | 11 | /** 12 | * @author Loïc Sculier aka typhon0 13 | */ 14 | public class Bounce extends AnimationFX { 15 | 16 | 17 | /** 18 | * Create new Bounce 19 | * 20 | * @param node The node to affect 21 | */ 22 | public Bounce(Node node) { 23 | super(node); 24 | } 25 | 26 | public Bounce() { 27 | super(); 28 | } 29 | 30 | @Override 31 | public AnimationFX resetNode() { 32 | getNode().setTranslateY(0); 33 | return this; 34 | } 35 | 36 | @Override 37 | void initTimeline() { 38 | setTimeline( 39 | new Timeline( 40 | 41 | new KeyFrame(Duration.millis(0), 42 | new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 43 | ), 44 | new KeyFrame(Duration.millis(400), 45 | new KeyValue(getNode().translateYProperty(), -30, Interpolator.SPLINE(0.755, 0.050, 0.855, 0.060)) 46 | ), 47 | new KeyFrame(Duration.millis(550), 48 | new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 49 | ), 50 | new KeyFrame(Duration.millis(700), 51 | new KeyValue(getNode().translateYProperty(), -15, Interpolator.SPLINE(0.755, 0.050, 0.855, 0.060)) 52 | ), 53 | new KeyFrame(Duration.millis(800), 54 | new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 55 | ), 56 | new KeyFrame(Duration.millis(900), 57 | new KeyValue(getNode().translateYProperty(), -5, Interpolator.SPLINE(0.755, 0.050, 0.855, 0.060)) 58 | ), 59 | new KeyFrame(Duration.millis(1000), 60 | new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 61 | ) 62 | 63 | )); 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/Hinge.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.scene.transform.Rotate; 9 | import javafx.util.Duration; 10 | 11 | /** 12 | * @author Loïc Sculier aka typhon0 13 | */ 14 | public class Hinge extends AnimationFX { 15 | 16 | 17 | private Rotate rotate; 18 | 19 | /** 20 | * Create new BounceInDown animation 21 | * 22 | * @param node The node to affect 23 | */ 24 | public Hinge(Node node) { 25 | super(node); 26 | 27 | } 28 | 29 | public Hinge() { 30 | } 31 | 32 | @Override 33 | AnimationFX resetNode() { 34 | getNode().setOpacity(1); 35 | getNode().setTranslateY(0); 36 | rotate.setAngle(0); 37 | return this; 38 | } 39 | 40 | @Override 41 | void initTimeline() { 42 | double endY = getNode().getScene().getHeight() - getNode().localToScene(0, 0).getY(); 43 | rotate = new Rotate(0, 0, 0); 44 | setTimeline(new Timeline( 45 | 46 | new KeyFrame(Duration.millis(0), 47 | new KeyValue(rotate.angleProperty(), 0, Interpolator.EASE_BOTH) 48 | ), 49 | new KeyFrame(Duration.millis(300), 50 | new KeyValue(rotate.angleProperty(), 80, Interpolator.EASE_BOTH) 51 | ), 52 | new KeyFrame(Duration.millis(650), 53 | new KeyValue(rotate.angleProperty(), 60, Interpolator.EASE_BOTH) 54 | ), 55 | new KeyFrame(Duration.millis(1050), 56 | new KeyValue(rotate.angleProperty(), 80, Interpolator.EASE_BOTH) 57 | ), 58 | new KeyFrame(Duration.millis(1450), 59 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.EASE_BOTH), 60 | new KeyValue(getNode().translateYProperty(), 0, Interpolator.EASE_BOTH), 61 | new KeyValue(rotate.angleProperty(), 60, Interpolator.EASE_BOTH) 62 | ), 63 | new KeyFrame(Duration.millis(1900), 64 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.EASE_BOTH), 65 | new KeyValue(getNode().translateYProperty(), endY, Interpolator.EASE_BOTH), 66 | new KeyValue(rotate.angleProperty(), 60, Interpolator.EASE_BOTH) 67 | ) 68 | )); 69 | getNode().getTransforms().add(rotate); 70 | 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/test/java/eu/mihosoft/nativefx/NativeBindingTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2019 Michael Hoffer . All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * If you use this software for scientific research then please cite the following publication(s): 17 | * 18 | * M. Hoffer, C. Poliwoda, & G. Wittum. (2013). Visual reflection library: 19 | * a framework for declarative GUI programming on the Java platform. 20 | * Computing and Visualization in Science, 2013, 16(4), 21 | * 181–192. http://doi.org/10.1007/s00791-014-0230-y 22 | */ 23 | /* 24 | * This Java source file was generated by the Gradle 'init' task. 25 | */ 26 | package eu.mihosoft.nativefx; 27 | 28 | import org.junit.Test; 29 | import static org.junit.Assert.*; 30 | 31 | /** 32 | * The tests do currently only verify that the JNI based native binding works. 33 | * This is to ensure that no {@link UnsatisfiedLinkError} and similar exceptions 34 | * are thrown. 35 | * 36 | *

Note:

we still need to ensure that the behavior for events 37 | * and buffer synchronization among multiple processes is consistent on all 38 | * supported platforms. So far, there's no formal description for expected 39 | * behavior. 40 | */ 41 | public class NativeBindingTest { 42 | @Test public void testNativeMethodsSendMsg() { 43 | NativeBinding.init(); 44 | 45 | int key = NativeBinding.connectTo("_mem"); 46 | String response = NativeBinding.sendMsg(key, "abcde"); 47 | 48 | System.out.println("Response: " + response); 49 | 50 | // assertTrue("sendMsg should return 'hello from native'", "hello from native!".equals(response)); 51 | } 52 | 53 | @Test public void testNativeMethodsConnectTo() { 54 | NativeBinding.init(); 55 | // TODO implement 56 | // int key = NativeBinding.connectTo("_mem"); 57 | // assertTrue("connectTo should return 0", 0==key); 58 | } 59 | 60 | @Test public void testNativeMethodsNextKey() { 61 | NativeBinding.init(); 62 | int key = NativeBinding.nextKey(); 63 | assertTrue("nextKey should return 0", 0==key); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/native/src/main/headers/jnitypeconverter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* 4 | * Copyright 2019-2019 Michael Hoffer . All rights reserved. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * If you use this software for scientific research then please cite the following publication(s): 19 | * 20 | * M. Hoffer, C. Poliwoda, & G. Wittum. (2013). Visual reflection library: 21 | * a framework for declarative GUI programming on the Java platform. 22 | * Computing and Visualization in Science, 2013, 16(4), 23 | * 181–192. http://doi.org/10.1007/s00791-014-0230-y 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | /** 31 | * Converts a Java boolean to a native boolean. 32 | * @param b Java boolean to convert 33 | * @return native boolean 34 | */ 35 | inline bool boolJ2C(jboolean b) { 36 | return b == JNI_TRUE; 37 | } 38 | 39 | /** 40 | * Converts a native boolean to a Java boolean. 41 | * @param b native boolean to convert 42 | * @return Java boolean 43 | */ 44 | inline jboolean boolC2J(bool b) { 45 | return b ? JNI_TRUE : JNI_FALSE; 46 | } 47 | 48 | /** 49 | * Converts a native string to a Java string. 50 | * @param env JVM environment to operate on 51 | * @param s string to convert 52 | * @return a java string 53 | */ 54 | jstring stringC2J(JNIEnv *env, const char* s); 55 | 56 | /** 57 | * Converts a native string to a Java string. 58 | * @param env JVM environment to operate on 59 | * @param s string to convert 60 | * @return a java string 61 | */ 62 | jstring stringC2J(JNIEnv *env, std::string const& s); 63 | 64 | /** 65 | *

66 | * Converts a Java string to a native string. 67 | *

68 | *

69 | * Note: this function must not be used to convert large amounts 70 | * of strings because of inefficient memory handling. 71 | *

72 | * @param env JVM environment to operate on 73 | * @param s string to convert 74 | * @return a native string 75 | */ 76 | std::string stringJ2C(JNIEnv *env, jstring const& s) ; 77 | 78 | jbyteArray ucharArray2JByteArray(JNIEnv* env, unsigned char* buf, int len); 79 | 80 | unsigned char* byteArray2ucharArray(JNIEnv* env, jbyteArray array); 81 | 82 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/ZoomOutUp.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier 12 | */ 13 | public class ZoomOutUp extends AnimationFX { 14 | 15 | /** 16 | * Create new ZoomOutUp 17 | * 18 | * @param node The node to affect 19 | */ 20 | public ZoomOutUp(Node node) { 21 | super(node); 22 | } 23 | 24 | public ZoomOutUp() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setScaleX(1); 31 | getNode().setScaleY(1); 32 | getNode().setScaleZ(1); 33 | getNode().setTranslateY(0); 34 | return this; 35 | } 36 | 37 | @Override 38 | void initTimeline() { 39 | setTimeline(new Timeline( 40 | new KeyFrame(Duration.millis(0), 41 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 46 | ), 47 | new KeyFrame(Duration.millis(400), 48 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 49 | new KeyValue(getNode().translateYProperty(), 60, AnimateFXInterpolator.EASE), 50 | new KeyValue(getNode().scaleXProperty(), 0.475, AnimateFXInterpolator.EASE), 51 | new KeyValue(getNode().scaleYProperty(), 0.475, AnimateFXInterpolator.EASE), 52 | new KeyValue(getNode().scaleZProperty(), 0.475, AnimateFXInterpolator.EASE) 53 | ), 54 | new KeyFrame(Duration.millis(1000), 55 | new KeyValue(getNode().translateYProperty(), -600, AnimateFXInterpolator.EASE), 56 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 57 | new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE), 58 | new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE), 59 | new KeyValue(getNode().scaleZProperty(), 0.1, AnimateFXInterpolator.EASE) 60 | ) 61 | )); 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/ZoomOutLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class ZoomOutLeft extends AnimationFX { 14 | 15 | /** 16 | * Create new ZoomOutLeft 17 | * 18 | * @param node The node to affect 19 | */ 20 | public ZoomOutLeft(Node node) { 21 | super(node); 22 | } 23 | 24 | public ZoomOutLeft() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setScaleX(1); 31 | getNode().setScaleY(1); 32 | getNode().setScaleZ(1); 33 | getNode().setTranslateX(0); 34 | return this; 35 | } 36 | 37 | @Override 38 | void initTimeline() { 39 | setTimeline(new Timeline( 40 | new KeyFrame(Duration.millis(0), 41 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 46 | ), 47 | new KeyFrame(Duration.millis(400), 48 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 49 | new KeyValue(getNode().translateXProperty(), 42, AnimateFXInterpolator.EASE), 50 | new KeyValue(getNode().scaleXProperty(), 0.475, AnimateFXInterpolator.EASE), 51 | new KeyValue(getNode().scaleYProperty(), 0.475, AnimateFXInterpolator.EASE), 52 | new KeyValue(getNode().scaleZProperty(), 0.475, AnimateFXInterpolator.EASE) 53 | ), 54 | new KeyFrame(Duration.millis(1100), 55 | new KeyValue(getNode().translateXProperty(), -2000, AnimateFXInterpolator.EASE), 56 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 57 | new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE), 58 | new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE), 59 | new KeyValue(getNode().scaleZProperty(), 0.1, AnimateFXInterpolator.EASE) 60 | ) 61 | )); 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/ZoomOutDown.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class ZoomOutDown extends AnimationFX { 14 | 15 | /** 16 | * Create new ZoomOutDown 17 | * 18 | * @param node The node to affect 19 | */ 20 | public ZoomOutDown(Node node) { 21 | super(node); 22 | } 23 | 24 | public ZoomOutDown() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setScaleX(1); 31 | getNode().setScaleY(1); 32 | getNode().setScaleZ(1); 33 | getNode().setTranslateY(0); 34 | return this; 35 | } 36 | 37 | @Override 38 | void initTimeline() { 39 | setTimeline(new Timeline( 40 | new KeyFrame(Duration.millis(0), 41 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 46 | ), 47 | new KeyFrame(Duration.millis(400), 48 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 49 | new KeyValue(getNode().translateYProperty(), -60, AnimateFXInterpolator.EASE), 50 | new KeyValue(getNode().scaleXProperty(), 0.475, AnimateFXInterpolator.EASE), 51 | new KeyValue(getNode().scaleYProperty(), 0.475, AnimateFXInterpolator.EASE), 52 | new KeyValue(getNode().scaleZProperty(), 0.475, AnimateFXInterpolator.EASE) 53 | ), 54 | new KeyFrame(Duration.millis(1000), 55 | new KeyValue(getNode().translateYProperty(), 600, AnimateFXInterpolator.EASE), 56 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 57 | new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE), 58 | new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE), 59 | new KeyValue(getNode().scaleZProperty(), 0.1, AnimateFXInterpolator.EASE) 60 | ) 61 | )); 62 | } 63 | 64 | } 65 | 66 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/ZoomOutRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class ZoomOutRight extends AnimationFX { 14 | 15 | /** 16 | * Create new ZoomOutRight 17 | * 18 | * @param node The node to affect 19 | */ 20 | public ZoomOutRight(Node node) { 21 | super(node); 22 | } 23 | 24 | public ZoomOutRight() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | getNode().setOpacity(1); 30 | getNode().setScaleX(1); 31 | getNode().setScaleY(1); 32 | getNode().setScaleZ(1); 33 | getNode().setTranslateX(0); 34 | return this; 35 | } 36 | 37 | @Override 38 | void initTimeline() { 39 | setTimeline(new Timeline( 40 | new KeyFrame(Duration.millis(0), 41 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE), 42 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 46 | ), 47 | new KeyFrame(Duration.millis(400), 48 | new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), 49 | new KeyValue(getNode().translateXProperty(), -42, AnimateFXInterpolator.EASE), 50 | new KeyValue(getNode().scaleXProperty(), 0.475, AnimateFXInterpolator.EASE), 51 | new KeyValue(getNode().scaleYProperty(), 0.475, AnimateFXInterpolator.EASE), 52 | new KeyValue(getNode().scaleZProperty(), 0.475, AnimateFXInterpolator.EASE) 53 | ), 54 | new KeyFrame(Duration.millis(1100), 55 | new KeyValue(getNode().translateXProperty(), 2000, AnimateFXInterpolator.EASE), 56 | new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), 57 | new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE), 58 | new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE), 59 | new KeyValue(getNode().scaleZProperty(), 0.1, AnimateFXInterpolator.EASE) 60 | ) 61 | )); 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/Shake.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class Shake extends AnimationFX { 14 | 15 | /** 16 | * Create new Shake 17 | * 18 | * @param node The node to affect 19 | */ 20 | public Shake(Node node) { 21 | super(node); 22 | } 23 | 24 | public Shake() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | new KeyFrame(Duration.millis(0), 36 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 37 | ), 38 | new KeyFrame(Duration.millis(100), 39 | new KeyValue(getNode().translateXProperty(), -10, AnimateFXInterpolator.EASE) 40 | ), 41 | new KeyFrame(Duration.millis(200), 42 | new KeyValue(getNode().translateXProperty(), 10, AnimateFXInterpolator.EASE) 43 | ), 44 | new KeyFrame(Duration.millis(300), 45 | new KeyValue(getNode().translateXProperty(), -10, AnimateFXInterpolator.EASE) 46 | ), 47 | new KeyFrame(Duration.millis(400), 48 | new KeyValue(getNode().translateXProperty(), 10, AnimateFXInterpolator.EASE) 49 | ), 50 | new KeyFrame(Duration.millis(500), 51 | new KeyValue(getNode().translateXProperty(), -10, AnimateFXInterpolator.EASE) 52 | ), 53 | new KeyFrame(Duration.millis(600), 54 | new KeyValue(getNode().translateXProperty(), 10, AnimateFXInterpolator.EASE) 55 | ), 56 | new KeyFrame(Duration.millis(700), 57 | new KeyValue(getNode().translateXProperty(), -10, AnimateFXInterpolator.EASE) 58 | ), 59 | new KeyFrame(Duration.millis(800), 60 | new KeyValue(getNode().translateXProperty(), 10, AnimateFXInterpolator.EASE) 61 | ), 62 | new KeyFrame(Duration.millis(900), 63 | new KeyValue(getNode().translateXProperty(), -10, AnimateFXInterpolator.EASE) 64 | ), 65 | new KeyFrame(Duration.millis(1000), 66 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE) 67 | ) 68 | )); 69 | } 70 | } 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/Jello.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.geometry.Bounds; 7 | import javafx.scene.Node; 8 | import javafx.scene.transform.Shear; 9 | import javafx.util.Duration; 10 | 11 | /** 12 | * @author Remi Lenoir 13 | */ 14 | 15 | public class Jello extends AnimationFX { 16 | /** 17 | * Create new Jello 18 | * 19 | * @param node The node to affect 20 | */ 21 | public Jello(Node node) { 22 | super(node); 23 | } 24 | 25 | public Jello() { 26 | } 27 | 28 | @Override 29 | AnimationFX resetNode() { 30 | 31 | return this; 32 | } 33 | 34 | @Override 35 | void initTimeline() { 36 | Shear shear = new Shear(); 37 | Bounds bounds = getNode().getLayoutBounds(); 38 | shear.setPivotX(bounds.getWidth() / 2); 39 | shear.setPivotY(bounds.getHeight() / 2); 40 | getNode().getTransforms().add(shear); 41 | setTimeline(new Timeline( 42 | new KeyFrame(Duration.millis(0), 43 | new KeyValue(shear.xProperty(), 0), 44 | new KeyValue(shear.yProperty(), 0)), 45 | new KeyFrame(Duration.millis(111), 46 | new KeyValue(shear.xProperty(), 0.125), 47 | new KeyValue(shear.yProperty(), 0.125)), 48 | new KeyFrame(Duration.millis(222), 49 | new KeyValue(shear.xProperty(), -0.625), 50 | new KeyValue(shear.yProperty(), -0.625)), 51 | new KeyFrame(Duration.millis(333), 52 | new KeyValue(shear.xProperty(), 0.3125), 53 | new KeyValue(shear.yProperty(), 0.3125)), 54 | new KeyFrame(Duration.millis(444), 55 | new KeyValue(shear.xProperty(), -0.15625), 56 | new KeyValue(shear.yProperty(), -0.15625)), 57 | new KeyFrame(Duration.millis(555), 58 | new KeyValue(shear.xProperty(), 0.078125), 59 | new KeyValue(shear.yProperty(), 0.078125)), 60 | new KeyFrame(Duration.millis(666), 61 | new KeyValue(shear.xProperty(), -0.0390625), 62 | new KeyValue(shear.yProperty(), -0.0390625)), 63 | new KeyFrame(Duration.millis(777), 64 | new KeyValue(shear.xProperty(), 0.01953125), 65 | new KeyValue(shear.yProperty(), 0.01953125)), 66 | new KeyFrame(Duration.millis(888), 67 | new KeyValue(shear.xProperty(), 0), 68 | new KeyValue(shear.yProperty(), 0)))); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/Flip.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.scene.ParallelCamera; 9 | import javafx.scene.PerspectiveCamera; 10 | import javafx.util.Duration; 11 | 12 | import static javafx.scene.transform.Rotate.Y_AXIS; 13 | 14 | 15 | /** 16 | * @author Loïc Sculier aka typhon0 17 | */ 18 | public class Flip extends AnimationFX { 19 | 20 | /** 21 | * Create new Flip 22 | * 23 | * @param node The node to affect 24 | */ 25 | public Flip(Node node) { 26 | super(node); 27 | } 28 | 29 | public Flip() { 30 | } 31 | 32 | @Override 33 | AnimationFX resetNode() { 34 | return this; 35 | } 36 | 37 | @Override 38 | void initTimeline() { 39 | getNode().getScene().setCamera(new PerspectiveCamera()); 40 | getNode().setRotationAxis(Y_AXIS); 41 | setTimeline(new Timeline( 42 | new KeyFrame(Duration.millis(0), 43 | new KeyValue(getNode().rotateProperty(), 360, Interpolator.EASE_OUT) 44 | ), 45 | new KeyFrame(Duration.millis(400), 46 | new KeyValue(getNode().rotateProperty(), 190, Interpolator.EASE_OUT), 47 | new KeyValue(getNode().translateZProperty(), -150, Interpolator.EASE_OUT) 48 | ), 49 | new KeyFrame(Duration.millis(500), 50 | new KeyValue(getNode().rotateProperty(), 170, Interpolator.EASE_IN), 51 | new KeyValue(getNode().translateZProperty(), -150, Interpolator.EASE_IN) 52 | ), 53 | new KeyFrame(Duration.millis(800), 54 | new KeyValue(getNode().scaleXProperty(), 0.95, Interpolator.EASE_IN), 55 | new KeyValue(getNode().scaleYProperty(), 0.95, Interpolator.EASE_IN), 56 | new KeyValue(getNode().scaleZProperty(), 0.95, Interpolator.EASE_IN) 57 | ), 58 | new KeyFrame(Duration.millis(1000), 59 | new KeyValue(getNode().rotateProperty(), 0, Interpolator.EASE_IN), 60 | new KeyValue(getNode().scaleXProperty(), 1, Interpolator.EASE_IN), 61 | new KeyValue(getNode().scaleYProperty(), 1, Interpolator.EASE_IN), 62 | new KeyValue(getNode().scaleZProperty(), 1, Interpolator.EASE_IN), 63 | new KeyValue(getNode().translateZProperty(), 0, Interpolator.EASE_IN) 64 | ) 65 | )); 66 | //TODO 67 | getTimeline().setOnFinished(event -> getNode().getScene().setCamera(new ParallelCamera())); 68 | 69 | } 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/ZoomInDown.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | 11 | /** 12 | * @author Loïc Sculier aka typhon0 13 | */ 14 | public class ZoomInDown extends AnimationFX { 15 | 16 | /** 17 | * Create new ZoomInDown 18 | * 19 | * @param node The node to affect 20 | */ 21 | public ZoomInDown(Node node) { 22 | super(node); 23 | } 24 | 25 | public ZoomInDown() { 26 | } 27 | 28 | @Override 29 | AnimationFX resetNode() { 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 38 | new KeyValue(getNode().translateYProperty(), -600, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 39 | new KeyValue(getNode().scaleXProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 40 | new KeyValue(getNode().scaleYProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 41 | new KeyValue(getNode().scaleZProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)) 42 | ), 43 | new KeyFrame(Duration.millis(600), 44 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 45 | new KeyValue(getNode().translateYProperty(), 60, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 46 | new KeyValue(getNode().scaleXProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 47 | new KeyValue(getNode().scaleYProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 48 | new KeyValue(getNode().scaleZProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)) 49 | ), 50 | new KeyFrame(Duration.millis(1000), 51 | new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 52 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 53 | new KeyValue(getNode().scaleXProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 54 | new KeyValue(getNode().scaleYProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 55 | new KeyValue(getNode().scaleZProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)) 56 | ) 57 | )); 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/ZoomInUp.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | 11 | /** 12 | * @author Loïc Sculier aka typhon0 13 | */ 14 | public class ZoomInUp extends AnimationFX { 15 | 16 | /** 17 | * Create new ZoomInUp 18 | * 19 | * @param node The node to affect 20 | */ 21 | public ZoomInUp(Node node) { 22 | super(node); 23 | } 24 | 25 | public ZoomInUp() { 26 | } 27 | 28 | @Override 29 | AnimationFX resetNode() { 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 38 | new KeyValue(getNode().translateYProperty(), 1000, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 39 | new KeyValue(getNode().scaleXProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 40 | new KeyValue(getNode().scaleYProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 41 | new KeyValue(getNode().scaleZProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)) 42 | ), 43 | new KeyFrame(Duration.millis(400), 44 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 45 | new KeyValue(getNode().translateYProperty(), 60, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 46 | new KeyValue(getNode().scaleXProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 47 | new KeyValue(getNode().scaleYProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 48 | new KeyValue(getNode().scaleZProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)) 49 | ), 50 | new KeyFrame(Duration.millis(1000), 51 | new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 52 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 53 | new KeyValue(getNode().scaleXProperty(), 1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 54 | new KeyValue(getNode().scaleYProperty(), 1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 55 | new KeyValue(getNode().scaleZProperty(), 1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)) 56 | ) 57 | )); 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/ZoomInLeft.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | 11 | /** 12 | * @author Loïc Sculier aka typhon0 13 | */ 14 | public class ZoomInLeft extends AnimationFX { 15 | 16 | /** 17 | * Create new ZoomInLeft 18 | * 19 | * @param node The node to affect 20 | */ 21 | public ZoomInLeft(Node node) { 22 | super(node); 23 | } 24 | 25 | public ZoomInLeft() { 26 | } 27 | 28 | @Override 29 | AnimationFX resetNode() { 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().translateXProperty(), -1000, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 38 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 39 | new KeyValue(getNode().scaleXProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 40 | new KeyValue(getNode().scaleYProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 41 | new KeyValue(getNode().scaleZProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)) 42 | ), 43 | new KeyFrame(Duration.millis(400), 44 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 45 | new KeyValue(getNode().translateXProperty(), 10, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 46 | new KeyValue(getNode().scaleXProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 47 | new KeyValue(getNode().scaleYProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 48 | new KeyValue(getNode().scaleZProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)) 49 | ), 50 | new KeyFrame(Duration.millis(1100), 51 | new KeyValue(getNode().translateXProperty(), 0, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 52 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 53 | new KeyValue(getNode().scaleXProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 54 | new KeyValue(getNode().scaleYProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 55 | new KeyValue(getNode().scaleZProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)) 56 | ) 57 | )); 58 | } 59 | 60 | } 61 | 62 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/ZoomInRight.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | 11 | /** 12 | * @author Loïc Sculier aka typhon0 13 | */ 14 | public class ZoomInRight extends AnimationFX { 15 | 16 | /** 17 | * Create new ZoomInRight 18 | * 19 | * @param node The node to affect 20 | */ 21 | public ZoomInRight(Node node) { 22 | super(node); 23 | } 24 | 25 | public ZoomInRight() { 26 | } 27 | 28 | @Override 29 | AnimationFX resetNode() { 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().translateXProperty(), 1000, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 38 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 39 | new KeyValue(getNode().scaleXProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 40 | new KeyValue(getNode().scaleYProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), 41 | new KeyValue(getNode().scaleZProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)) 42 | ), 43 | new KeyFrame(Duration.millis(400), 44 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 45 | new KeyValue(getNode().translateXProperty(), -10, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 46 | new KeyValue(getNode().scaleXProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 47 | new KeyValue(getNode().scaleYProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 48 | new KeyValue(getNode().scaleZProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)) 49 | ), 50 | new KeyFrame(Duration.millis(1100), 51 | new KeyValue(getNode().translateXProperty(), 0, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 52 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 53 | new KeyValue(getNode().scaleXProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 54 | new KeyValue(getNode().scaleYProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), 55 | new KeyValue(getNode().scaleZProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)) 56 | ) 57 | )); 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/Wobble.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.util.Duration; 8 | 9 | /** 10 | * @author Loïc Sculier aka typhon0 11 | */ 12 | public class Wobble extends AnimationFX { 13 | 14 | /** 15 | * Create new Wobble 16 | * 17 | * @param node The node to affect 18 | */ 19 | public Wobble(Node node) { 20 | super(node); 21 | } 22 | 23 | public Wobble() { 24 | } 25 | 26 | @Override 27 | AnimationFX resetNode() { 28 | 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | setTimeline(new Timeline( 35 | new KeyFrame(Duration.millis(0), 36 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE), 37 | new KeyValue(getNode().rotateProperty(), -0, AnimateFXInterpolator.EASE) 38 | ), 39 | new KeyFrame(Duration.millis(150), 40 | new KeyValue(getNode().translateXProperty(), -0.25 * getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE), 41 | new KeyValue(getNode().rotateProperty(), -5, AnimateFXInterpolator.EASE) 42 | ), 43 | new KeyFrame(Duration.millis(300), 44 | new KeyValue(getNode().translateXProperty(), 0.2 * getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().rotateProperty(), 3, AnimateFXInterpolator.EASE) 46 | ), 47 | new KeyFrame(Duration.millis(450), 48 | new KeyValue(getNode().translateXProperty(), -0.15 * getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE), 49 | new KeyValue(getNode().rotateProperty(), -3, AnimateFXInterpolator.EASE) 50 | ), 51 | new KeyFrame(Duration.millis(600), 52 | new KeyValue(getNode().translateXProperty(), 0.1 * getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE), 53 | new KeyValue(getNode().rotateProperty(), 2, AnimateFXInterpolator.EASE) 54 | ), 55 | new KeyFrame(Duration.millis(750), 56 | new KeyValue(getNode().translateXProperty(), -0.05 * getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE), 57 | new KeyValue(getNode().rotateProperty(), -1, AnimateFXInterpolator.EASE) 58 | ), 59 | new KeyFrame(Duration.millis(1000), 60 | new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE), 61 | new KeyValue(getNode().rotateProperty(), 0, AnimateFXInterpolator.EASE) 62 | ) 63 | )); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/BounceIn.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Interpolator; 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class BounceIn extends AnimationFX { 14 | 15 | 16 | /** 17 | * Create new BounceIn 18 | * 19 | * @param node The node to affect 20 | */ 21 | public BounceIn(Node node) { 22 | super(node); 23 | 24 | } 25 | 26 | public BounceIn() { 27 | super(); 28 | } 29 | 30 | @Override 31 | AnimationFX resetNode() { 32 | return this; 33 | } 34 | 35 | @Override 36 | void initTimeline() { 37 | setTimeline(new Timeline( 38 | new KeyFrame(Duration.millis(0), 39 | new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 40 | new KeyValue(getNode().scaleXProperty(), 0.3, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 41 | new KeyValue(getNode().scaleYProperty(), 0.3, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 42 | ), 43 | new KeyFrame(Duration.millis(200), 44 | new KeyValue(getNode().scaleXProperty(), 1.1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 45 | new KeyValue(getNode().scaleYProperty(), 1.1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 46 | ), 47 | new KeyFrame(Duration.millis(400), 48 | new KeyValue(getNode().scaleXProperty(), 0.9, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 49 | new KeyValue(getNode().scaleYProperty(), 0.9, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 50 | ), 51 | new KeyFrame(Duration.millis(600), 52 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 53 | new KeyValue(getNode().scaleXProperty(), 1.03, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 54 | new KeyValue(getNode().scaleYProperty(), 1.03, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 55 | ), 56 | new KeyFrame(Duration.millis(800), 57 | new KeyValue(getNode().scaleXProperty(), 0.97, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 58 | new KeyValue(getNode().scaleYProperty(), 0.97, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 59 | ), 60 | new KeyFrame(Duration.millis(1000), 61 | new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 62 | new KeyValue(getNode().scaleXProperty(), 1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)), 63 | new KeyValue(getNode().scaleYProperty(), 1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)) 64 | ) 65 | 66 | )); 67 | 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/GlowBackground.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.geometry.Insets; 7 | import javafx.scene.layout.Background; 8 | import javafx.scene.layout.BackgroundFill; 9 | import javafx.scene.layout.CornerRadii; 10 | import javafx.scene.layout.Region; 11 | import javafx.scene.paint.Color; 12 | import javafx.util.Duration; 13 | 14 | /** 15 | * Makes the node's background "glow" alternating between two colors. 16 | * If the node has a {@link Background}, then the {@link CornerRadii} and {@link Insets} 17 | * of the last of its {@link BackgroundFill}s are used for the glowing background 18 | * 19 | * @author negste 20 | */ 21 | public class GlowBackground extends AnimationFX { 22 | 23 | private final Background originalBackground; 24 | private CornerRadii originalRadii; 25 | private Insets originalInsets; 26 | 27 | /** 28 | * Constructs the animation 29 | * 30 | * @param node the node to animate 31 | * @param colorA the color to start with 32 | * @param colorB the other color 33 | * @param colorSteps how many interpolations between the two colors 34 | */ 35 | public GlowBackground(Region node, Color colorA, Color colorB, int colorSteps) { 36 | super(node); 37 | this.originalBackground = getNode().backgroundProperty().get(); 38 | if (originalBackground != null && !originalBackground.getFills().isEmpty()) { 39 | BackgroundFill lastFill = originalBackground.getFills().get(originalBackground.getFills().size() - 1); 40 | originalRadii = lastFill.getRadii(); 41 | originalInsets = lastFill.getInsets(); 42 | } else { 43 | originalRadii = CornerRadii.EMPTY; 44 | originalInsets = Insets.EMPTY; 45 | } 46 | 47 | int totalFrames = colorSteps * 2; 48 | double millisPerFrame = 1000 / totalFrames; 49 | for (int i = 0; i < totalFrames; i++) { 50 | Color color; 51 | double frac = i * 2.0 / totalFrames; 52 | Duration dur = Duration.millis(i * millisPerFrame); 53 | if (i <= colorSteps) { 54 | color = colorA.interpolate(colorB, frac); 55 | } else { 56 | color = colorB.interpolate(colorA, frac - 1); 57 | } 58 | getTimeline().getKeyFrames().add( 59 | new KeyFrame(dur, 60 | new KeyValue(getNode().backgroundProperty(), 61 | // new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY))))); 62 | new Background(new BackgroundFill(color, originalRadii, originalInsets))))); 63 | } 64 | 65 | } 66 | 67 | public GlowBackground(Background originalBackground) { 68 | this.originalBackground = originalBackground; 69 | } 70 | 71 | 72 | @Override 73 | public Region getNode() { 74 | return (Region) super.getNode(); 75 | } 76 | 77 | @Override 78 | AnimationFX resetNode() { 79 | getNode().setBackground(originalBackground); 80 | return this; 81 | } 82 | 83 | @Override 84 | void initTimeline() { 85 | setTimeline(new Timeline()); //will be populated at the end of constructor 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/RubberBand.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | 4 | import javafx.animation.KeyFrame; 5 | import javafx.animation.KeyValue; 6 | import javafx.animation.Timeline; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | 11 | /** 12 | * @author Loïc Sculier aka typhon0 13 | */ 14 | public class RubberBand extends AnimationFX { 15 | 16 | /** 17 | * Create new RubberBand 18 | * 19 | * @param node The node to affect 20 | */ 21 | public RubberBand(Node node) { 22 | super(node); 23 | } 24 | 25 | public RubberBand() { 26 | } 27 | 28 | @Override 29 | AnimationFX resetNode() { 30 | return this; 31 | } 32 | 33 | @Override 34 | void initTimeline() { 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 38 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 40 | ), 41 | new KeyFrame(Duration.millis(300), 42 | new KeyValue(getNode().scaleXProperty(), 1.25, AnimateFXInterpolator.EASE), 43 | new KeyValue(getNode().scaleYProperty(), 0.75, AnimateFXInterpolator.EASE), 44 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 45 | ), 46 | new KeyFrame(Duration.millis(400), 47 | new KeyValue(getNode().scaleXProperty(), 0.75, AnimateFXInterpolator.EASE), 48 | new KeyValue(getNode().scaleYProperty(), 1.25, AnimateFXInterpolator.EASE), 49 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 50 | ), 51 | new KeyFrame(Duration.millis(500), 52 | new KeyValue(getNode().scaleXProperty(), 1.15, AnimateFXInterpolator.EASE), 53 | new KeyValue(getNode().scaleYProperty(), 0.85, AnimateFXInterpolator.EASE), 54 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 55 | ), 56 | new KeyFrame(Duration.millis(650), 57 | new KeyValue(getNode().scaleXProperty(), 0.95, AnimateFXInterpolator.EASE), 58 | new KeyValue(getNode().scaleYProperty(), 1.05, AnimateFXInterpolator.EASE), 59 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 60 | ), 61 | new KeyFrame(Duration.millis(750), 62 | new KeyValue(getNode().scaleXProperty(), 1.05, AnimateFXInterpolator.EASE), 63 | new KeyValue(getNode().scaleYProperty(), 0.95, AnimateFXInterpolator.EASE), 64 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 65 | ), 66 | new KeyFrame(Duration.millis(1000), 67 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 68 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 69 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) 70 | ) 71 | )); 72 | } 73 | 74 | } 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/main/java/animatefx/util/ParallelAnimationFX.java: -------------------------------------------------------------------------------- 1 | package animatefx.util; 2 | 3 | import animatefx.animation.AnimationFX; 4 | import javafx.animation.Animation; 5 | import javafx.beans.property.ObjectProperty; 6 | import javafx.beans.property.SimpleObjectProperty; 7 | import javafx.collections.FXCollections; 8 | import javafx.collections.ObservableList; 9 | import javafx.scene.Node; 10 | 11 | /** 12 | * @author Loïc Sculier aka typhon0 13 | */ 14 | public class ParallelAnimationFX { 15 | 16 | private Animation.Status status; 17 | 18 | private ObjectProperty node; 19 | 20 | private boolean reset; 21 | 22 | /** 23 | * The node property 24 | * 25 | * @return node property 26 | */ 27 | public final ObjectProperty nodeProperty() { 28 | if (node == null) { 29 | node = new SimpleObjectProperty<>(this, "node", null); 30 | } 31 | return node; 32 | } 33 | 34 | private ObservableList animations = FXCollections.observableArrayList(); 35 | 36 | public ParallelAnimationFX(Node node) { 37 | nodeProperty().set(node); 38 | reset = false; 39 | } 40 | 41 | public ParallelAnimationFX(Node node, AnimationFX... animations) { 42 | nodeProperty().set(node); 43 | getAnimation().setAll(animations); 44 | reset = false; 45 | } 46 | 47 | public ParallelAnimationFX(AnimationFX... animations) { 48 | getAnimation().setAll(animations); 49 | reset = false; 50 | } 51 | 52 | public ParallelAnimationFX() { 53 | } 54 | 55 | /** 56 | * A list of {@link AnimationFX Animations} that will be 57 | * played in parallel. 58 | *

59 | * It is not possible to change the animation of a running 60 | * {@code ParallelAnimationFX}. If the animation are changed for a running 61 | * {@code ParallelAnimationFX}, the animation has to be stopped and started 62 | * again to pick up the new value. 63 | */ 64 | public final ObservableList getAnimation() { 65 | return animations; 66 | } 67 | 68 | 69 | /** 70 | * Set the node 71 | * 72 | * @param value the node 73 | */ 74 | public void setNode(Node value) { 75 | if ((node != null) || (value != null)) { 76 | nodeProperty().set(value); 77 | } 78 | } 79 | 80 | /** 81 | * Play the animations 82 | */ 83 | public void play() { 84 | initAnimations(); 85 | getAnimation().get(0).play(); 86 | status = Animation.Status.RUNNING; 87 | } 88 | 89 | /** 90 | * Initialize which animation to play after another 91 | */ 92 | private void initAnimations() { 93 | for (AnimationFX animation: animations) { 94 | if (nodeProperty().get() != null) { 95 | if (animation.getNode() == null) { 96 | animation.setNode(nodeProperty().get()); 97 | } 98 | } 99 | animation.play(); 100 | } 101 | } 102 | 103 | /** 104 | * Stop the animations 105 | */ 106 | public void stop() { 107 | status = Animation.Status.STOPPED; 108 | for (AnimationFX animationFX : animations) { 109 | animationFX.stop(); 110 | } 111 | } 112 | 113 | /** 114 | * Get the status 115 | * 116 | * @return animations status 117 | */ 118 | public Animation.Status getStatus() { 119 | return status; 120 | } 121 | 122 | /** 123 | * Set if the node have to reset at the end 124 | * 125 | * @param value true to reset 126 | */ 127 | public void setResetOnFinished(boolean value) { 128 | this.reset = value; 129 | } 130 | } 131 | 132 | 133 | -------------------------------------------------------------------------------- /sample-servers/nativefx-qt/src/main/cpp/vfxwebpage.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "vfxwebpage.h" 5 | 6 | 7 | VFXWebPage::VFXWebPage(): QWebEngineView(nullptr), child_(nullptr), image(nullptr), eventsReciverWidget(nullptr) { 8 | } 9 | 10 | void VFXWebPage::request_redraw(QImage* img) { 11 | this->image = img; 12 | } 13 | 14 | void VFXWebPage::set_redraw_callback(std::function redraw_callback) { 15 | this->redraw_callback = redraw_callback; 16 | } 17 | 18 | void VFXWebPage::set_native_event_callback(std::function native_evt_callback) { 19 | connect(this, &QWebEngineView::loadFinished, [native_evt_callback](){native_evt_callback("web:load-finished","");}); 20 | //connect(this, &QWebEngineView::loadFinished, native_evt_callback); 21 | } 22 | 23 | 24 | void VFXWebPage::sendSimulatedEvent(QEvent *evt) { 25 | 26 | if(eventsReciverWidget==nullptr) { 27 | // Find the first child widget of QWebEngineView. It can accept user input events. 28 | for(QObject* obj : this->children()) 29 | { 30 | QWidget* wgt = qobject_cast(obj); 31 | if (wgt) 32 | { 33 | eventsReciverWidget = wgt; 34 | break; 35 | } 36 | } 37 | } 38 | 39 | QApplication::sendEvent(eventsReciverWidget, evt); 40 | } 41 | 42 | //@override 43 | bool VFXWebPage::event(QEvent * ev) { 44 | // based on https://stackoverflow.com/questions/30566101/how-can-i-get-paint-events-with-qtwebengine/33576854 45 | if (ev->type() == QEvent::ChildAdded) { 46 | QChildEvent *child_ev = static_cast(ev); 47 | 48 | // there is also QObject child that should be ignored here; 49 | // use only QOpenGLWidget child 50 | QOpenGLWidget *w = qobject_cast(child_ev->child()); 51 | if (w) { 52 | child_ = w; 53 | w->installEventFilter(this); 54 | } 55 | } 56 | 57 | return QWebEngineView::event(ev); 58 | } 59 | 60 | void VFXWebPage::paintEvent(QPaintEvent * event) { 61 | qDebug() << "paintEvent(" << event << ")"; 62 | QWebEngineView::paintEvent(event); 63 | 64 | qDebug() << event->rect(); 65 | qDebug() << event->region(); 66 | } 67 | 68 | bool VFXWebPage::eventFilter(QObject *obj, QEvent *ev) 69 | { 70 | // emit delegatePaint on paint event of the last added QOpenGLWidget child 71 | if (obj == child_ && ev->type() == QEvent::Paint) { 72 | QPaintEvent *pe = static_cast(ev); 73 | // do something with paint event 74 | paintEvent(pe); 75 | // and emit signal to notify other objects 76 | emit delegatePaint(pe); 77 | } 78 | 79 | // qDebug() << "EVTYPE: " << ev->type(); 80 | 81 | if (ev->type() == QEvent::UpdateRequest) { 82 | 83 | if(image!=nullptr) { 84 | // qDebug() << "begin"; 85 | QPainter painter(image); 86 | this->page()->view()->render(&painter); 87 | painter.end(); 88 | // qDebug() << "end"; 89 | } else { 90 | qDebug() << "img null"; 91 | } 92 | 93 | redraw_callback(); 94 | } 95 | 96 | return QWebEngineView::eventFilter(obj, ev); 97 | } 98 | 99 | //@override 100 | void VFXWebPage::childEvent(QChildEvent *event) { 101 | qDebug() << "childEvent(" << event << ")"; 102 | } 103 | 104 | -------------------------------------------------------------------------------- /gradle/publishing.gradle: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // Collect publishing information 3 | // ----------------------------------------------------------------------------- 4 | ext.publishing = [:] 5 | ext.publishing.bintray = [:] 6 | 7 | ext.publishing.pomName = ext.publishing.artifactId 8 | 9 | apply from: "gradle/project-info.gradle" 10 | 11 | // ----------------------------------------------------------------------------- 12 | // Performs publishing 13 | // ----------------------------------------------------------------------------- 14 | 15 | task javadocJar(type: Jar, dependsOn: javadoc) { 16 | classifier = 'javadoc' 17 | from javadoc.destinationDir 18 | } 19 | 20 | // create one jar for the source files 21 | task sourcesJar(type: Jar, dependsOn: classes) { 22 | classifier = 'sources' 23 | from sourceSets.main.allSource 24 | } 25 | 26 | artifacts { 27 | archives jar 28 | archives javadocJar 29 | archives sourcesJar 30 | } 31 | Date buildTimeAndDate = new Date() 32 | ext { 33 | buildDate = new java.text.SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate) 34 | buildTime = new java.text.SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate) 35 | } 36 | 37 | jar { 38 | manifest { 39 | attributes( 40 | 'Built-By': System.properties['user.name'], 41 | 'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.properties['java.vm.version'] + ")", 42 | 'Build-Date': project.buildDate, 43 | 'Build-Time': project.buildTime, 44 | 'Build-Revision': versioning.info.commit, 45 | 'Specification-Title': project.name, 46 | 'Specification-Version': project.version, 47 | 'Implementation-Title': project.name, 48 | 'Implementation-Version': project.version 49 | ) 50 | } 51 | } 52 | 53 | 54 | def pomConfig = { 55 | name ext.publishing.pomName 56 | description ext.publishing.desc 57 | url ext.publishing.websiteUrl 58 | inceptionYear ext.publishing.inceptionYear 59 | licenses { 60 | license([:]) { 61 | name ext.publishing.license 62 | url ext.publishing.licenseUrl 63 | distribution 'repo' 64 | } 65 | } 66 | scm { 67 | url ext.publishing.vcsUrl 68 | connection ext.publishing.vcsUrl 69 | developerConnection ext.publishing.vcsUrl 70 | } 71 | developers { 72 | developer { 73 | id ext.publishing.developerNameAlias 74 | name ext.publishing.developerName 75 | } 76 | } 77 | } 78 | 79 | publishing { 80 | publications { 81 | mavenCustom(MavenPublication) { 82 | groupId publishing.groupId 83 | artifactId publishing.artifactId 84 | version publishing.versionId 85 | from components.java 86 | artifact sourcesJar 87 | artifact javadocJar 88 | 89 | pom.withXml { 90 | def root = asNode() 91 | root.appendNode 'description', publishing.desc 92 | root.children().last() + pomConfig 93 | } 94 | } 95 | } 96 | } 97 | 98 | if (!project.hasProperty('bintrayUsername')) ext.bintrayUsername = '' 99 | if (!project.hasProperty('bintrayApiKey')) ext.bintrayApiKey = '' 100 | 101 | bintray { 102 | user = project.bintrayUsername 103 | key = project.bintrayApiKey 104 | publications = ['mavenCustom'] 105 | pkg { 106 | repo = publishing.bintray.repo 107 | userOrg = publishing.bintray.userOrg 108 | name = publishing.bintray.name 109 | desc = publishing.desc 110 | licenses = [publishing.license] 111 | labels = publishing.labels 112 | websiteUrl = publishing.websiteUrl 113 | issueTrackerUrl = publishing.issueTrackerUrl 114 | vcsUrl = publishing.vcsUrl 115 | publicDownloadNumbers = true 116 | 117 | version { 118 | name = publishing.versionId 119 | vcsTag = 'v' + publishing.versionId 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /sample-servers/sample-server/src/main/cpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include "nativefx/nativefx_server.hpp" 2 | 3 | int main(int argc, char *argv[]) { 4 | 5 | using namespace nativefx; 6 | 7 | int counter = 0; 8 | 9 | int numValues = 10; 10 | double fpsValues[10]; 11 | auto frameTimeStamp = std::chrono::high_resolution_clock::now(); 12 | int fpsCounter = 0; 13 | 14 | auto redraw = [&counter, numValues, &fpsValues, &frameTimeStamp, &fpsCounter](std::string const& name, uchar* buffer_data, int W, int H) { 15 | 16 | auto currentTimeStamp = std::chrono::high_resolution_clock::now(); 17 | 18 | // std::this_thread::sleep_for(std::chrono::milliseconds(10)); 19 | 20 | for(int y = 0; y < H; ++y) { 21 | for(int x = 0; x < W;++x) { 22 | nativefx::set_rgba(buffer_data,W,H,x,y, 23 | 0, // R 24 | 0, // G 25 | 0, // B 26 | 255 // A 27 | ); 28 | } 29 | } 30 | 31 | for(double alpha = 0; alpha < 2 * M_PI; alpha+=0.001) { 32 | int x = W/2+sin(alpha)*(counter%(W/2)); 33 | int y = H/2+cos(alpha)*(counter%(W/2)); 34 | if(x > 0 && x < W && y > 0 && y < H) { 35 | nativefx::set_rgba(buffer_data,W,H,x,y, 36 | 255, // R 37 | 0, // G 38 | 0, // B 39 | 255 // A 40 | ); 41 | } 42 | } 43 | 44 | counter+=5; 45 | 46 | for(int x = 0; x < W;++x) { 47 | int y = (double)H/(double)W * x; 48 | 49 | nativefx::set_rgba(buffer_data,W,H,x,y, 50 | 255, // R 51 | 0, // G 52 | 0, // B 53 | 255 // A 54 | ); 55 | 56 | int x_mirror = W-x; 57 | 58 | nativefx::set_rgba(buffer_data,W,H,x_mirror,y, 59 | 0, // R 60 | 255, // G 61 | 0, // B 62 | 255 // A 63 | ); 64 | } 65 | 66 | long durationNano = std::chrono::duration_cast(currentTimeStamp-frameTimeStamp).count(); 67 | 68 | double fps = 1e9 / durationNano; 69 | 70 | fpsValues[fpsCounter] = fps; 71 | 72 | if(fpsCounter == numValues -1) { 73 | double fpsAverage = 0; 74 | 75 | for(double fpsVal : fpsValues) { 76 | fpsAverage+=fpsVal; 77 | } 78 | 79 | fpsAverage/=numValues; 80 | 81 | std::cout << "[" << name << "]> fps: " << fpsAverage << std::endl; 82 | 83 | fpsCounter = 0; 84 | } 85 | 86 | fpsCounter++; 87 | 88 | frameTimeStamp = currentTimeStamp; 89 | 90 | 91 | }; 92 | 93 | auto evt = [](std::string const &name, event* evt) { 94 | std::cout << "[" + name + "] " << "event received: type=" << evt->type << ", "; 95 | 96 | if(evt->type & NFX_MOUSE_EVENT) { 97 | mouse_event* evt_mouse_evt = static_cast((void*)evt); 98 | std::cout << "x: " << evt_mouse_evt->x << ", y: " << evt_mouse_evt->x; 99 | } 100 | 101 | if(evt->type & NFX_MOUSE_PRESSED) { 102 | mouse_event* evt_mouse_evt = static_cast((void*)evt); 103 | std::cout << ", evt_name: PRESSED" << std::endl; 104 | } else if(evt->type & NFX_MOUSE_RELEASED) { 105 | mouse_event* evt_mouse_evt = static_cast((void*)evt); 106 | std::cout << ", evt_name: RLEASED" << std::endl; 107 | } else if(evt->type & NFX_MOUSE_ENTERED) { 108 | mouse_event* evt_mouse_evt = static_cast((void*)evt); 109 | std::cout << ", evt_name: ENTERED" << std::endl; 110 | } else if(evt->type & NFX_MOUSE_EXITED) { 111 | mouse_event* evt_mouse_evt = static_cast((void*)evt); 112 | std::cout << ", evt_name: EXITED" << std::endl; 113 | } else if(evt->type & NFX_MOUSE_CLICKED) { 114 | mouse_event* evt_mouse_evt = static_cast((void*)evt); 115 | std::cout << ", #clicks: " << evt_mouse_evt->click_count << std::endl; 116 | } else { 117 | std::cout << std::endl; 118 | } 119 | }; 120 | 121 | nativefx::start_server(argc, argv, redraw, evt); 122 | } -------------------------------------------------------------------------------- /src/main/java/animatefx/util/SequentialAnimationFX.java: -------------------------------------------------------------------------------- 1 | package animatefx.util; 2 | 3 | import animatefx.animation.AnimationFX; 4 | import javafx.animation.Animation; 5 | import javafx.beans.property.ObjectProperty; 6 | import javafx.beans.property.SimpleObjectProperty; 7 | import javafx.collections.FXCollections; 8 | import javafx.collections.ObservableList; 9 | import javafx.scene.Node; 10 | 11 | /** 12 | * @author Loïc Sculier aka typhon0 13 | */ 14 | public class SequentialAnimationFX { 15 | 16 | private Animation.Status status; 17 | 18 | private ObjectProperty node; 19 | 20 | private boolean reset; 21 | 22 | /** 23 | * The node property 24 | * 25 | * @return node property 26 | */ 27 | public final ObjectProperty nodeProperty() { 28 | if (node == null) { 29 | node = new SimpleObjectProperty<>(this, "node", null); 30 | } 31 | return node; 32 | } 33 | 34 | private ObservableList animations = FXCollections.observableArrayList(); 35 | 36 | public SequentialAnimationFX(Node node) { 37 | nodeProperty().set(node); 38 | reset = false; 39 | } 40 | 41 | public SequentialAnimationFX(Node node, AnimationFX... animations) { 42 | nodeProperty().set(node); 43 | getAnimation().setAll(animations); 44 | reset = false; 45 | } 46 | 47 | public SequentialAnimationFX(AnimationFX... animations) { 48 | getAnimation().setAll(animations); 49 | reset = false; 50 | } 51 | 52 | public SequentialAnimationFX() { 53 | } 54 | 55 | /** 56 | * A list of {@link AnimationFX Animations} that will be 57 | * played sequentially. 58 | *

59 | * It is not possible to change the animation of a running 60 | * {@code SequentialAnimationFX}. If the animation are changed for a running 61 | * {@code SequentialAnimationFX}, the animation has to be stopped and started 62 | * again to pick up the new value. 63 | */ 64 | public final ObservableList getAnimation() { 65 | return animations; 66 | } 67 | 68 | 69 | /** 70 | * Set the node 71 | * 72 | * @param value the node 73 | */ 74 | public void setNode(Node value) { 75 | if ((node != null) || (value != null)) { 76 | nodeProperty().set(value); 77 | } 78 | } 79 | 80 | /** 81 | * Play the animations 82 | */ 83 | public void play() { 84 | initAnimations(); 85 | getAnimation().get(0).play(); 86 | status = Animation.Status.RUNNING; 87 | } 88 | 89 | /** 90 | * Initialize which animation to play after another 91 | */ 92 | private void initAnimations() { 93 | for (int i = 0; i < getAnimation().size() - 1; i++) { 94 | if (nodeProperty().get() != null) { 95 | if (getAnimation().get(i).getNode() == null) { 96 | getAnimation().get(i).setNode(nodeProperty().get()); 97 | } 98 | } 99 | if (getAnimation().get(i + 1) != null) { 100 | getAnimation().get(i).playOnFinished(getAnimation().get(i + 1)); 101 | } 102 | } 103 | // config last animation 104 | if (nodeProperty().get() != null) { 105 | if (getAnimation().get(getAnimation().size() - 1).getNode() == null) { 106 | getAnimation().get(getAnimation().size() - 1).setNode(nodeProperty().get()); 107 | } 108 | } 109 | if (reset) { 110 | getAnimation().get(getAnimation().size() - 1).setResetOnFinished(true); 111 | } 112 | } 113 | 114 | /** 115 | * Stop the animations 116 | */ 117 | public void stop() { 118 | status = Animation.Status.STOPPED; 119 | for (AnimationFX animationFX : animations) { 120 | animationFX.stop(); 121 | } 122 | } 123 | 124 | /** 125 | * Get the status 126 | * 127 | * @return animations status 128 | */ 129 | public Animation.Status getStatus() { 130 | return status; 131 | } 132 | 133 | /** 134 | * Set if the node have to reset at the end 135 | * 136 | * @param value true to reset 137 | */ 138 | public void setResetOnFinished(boolean value) { 139 | this.reset = value; 140 | } 141 | } 142 | 143 | 144 | -------------------------------------------------------------------------------- /src/main/java/eu/mihosoft/nativefx/NativeFXApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2019 Michael Hoffer . All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * If you use this software for scientific research then please cite the following publication(s): 17 | * 18 | * M. Hoffer, C. Poliwoda, & G. Wittum. (2013). Visual reflection library: 19 | * a framework for declarative GUI programming on the Java platform. 20 | * Computing and Visualization in Science, 2013, 16(4), 21 | * 181–192. http://doi.org/10.1007/s00791-014-0230-y 22 | */ 23 | package eu.mihosoft.nativefx; 24 | 25 | import java.nio.ByteBuffer; 26 | 27 | import animatefx.animation.FlipInY; 28 | import javafx.application.Application; 29 | import javafx.scene.Node; 30 | import javafx.scene.Parent; 31 | import javafx.scene.Scene; 32 | import javafx.scene.control.Button; 33 | import javafx.scene.control.CheckBox; 34 | import javafx.scene.control.Label; 35 | import javafx.scene.control.MenuBar; 36 | import javafx.scene.control.TextField; 37 | import javafx.scene.control.ToolBar; 38 | import javafx.scene.effect.BoxBlur; 39 | import javafx.scene.effect.PerspectiveTransform; 40 | import javafx.scene.layout.HBox; 41 | import javafx.scene.layout.Priority; 42 | import javafx.scene.layout.Region; 43 | import javafx.scene.layout.StackPane; 44 | import javafx.scene.layout.VBox; 45 | import javafx.stage.Stage; 46 | 47 | public class NativeFXApp extends Application { 48 | 49 | public void start(Stage primaryStage) { 50 | 51 | VBox root = new VBox(); 52 | 53 | //CheckBox hidpiCB = new CheckBox("HiDPI Mode"); 54 | CheckBox pbAPICB = new CheckBox("PixelBuffer API"); 55 | 56 | TextField tf = new TextField("mem1"); 57 | Button btn = new Button("Connect"); 58 | Button delBtn = new Button("Delete All"); 59 | Button effect1Btn = new Button("Blur Effect"); 60 | 61 | effect1Btn.setOnAction((ae)-> { 62 | root.getChildren().filtered(n->n instanceof NativeNode). 63 | forEach(n->{ 64 | BoxBlur blur = new BoxBlur(10, 10, 10); 65 | n.setEffect(blur); 66 | }); 67 | }); 68 | 69 | Button effectDisableBtn = new Button("Disable Effect"); 70 | 71 | effectDisableBtn.setOnAction((ae)-> { 72 | root.getChildren().filtered(n->n instanceof NativeNode). 73 | forEach(n->{ 74 | n.setEffect(null); 75 | }); 76 | }); 77 | 78 | Button animateBtn = new Button("Animate Nodes"); 79 | 80 | animateBtn.setOnAction((ae)-> { 81 | root.getChildren().filtered(n->n instanceof NativeNode). 82 | forEach(n->{ 83 | FlipInY flipInY = new FlipInY(n); 84 | flipInY.setSpeed(0.1); 85 | flipInY.setCycleCount(1); 86 | flipInY.play(); 87 | }); 88 | }); 89 | 90 | delBtn.setOnAction((ae)-> { 91 | root.getChildren().filtered(n->n instanceof NativeNode). 92 | forEach(n->{ 93 | NativeNode nn = (NativeNode) n; 94 | nn.terminate(); 95 | }); 96 | root.getChildren().removeIf(n->n instanceof NativeNode); 97 | }); 98 | 99 | btn.setOnAction((ae)-> { 100 | 101 | NativeNode nativeN = new NativeNode(false/*hidpiCB.isSelected()*/, pbAPICB.isSelected()); 102 | 103 | nativeN.setVerbose(true); 104 | VBox.setVgrow(nativeN,Priority.SOMETIMES); 105 | try { 106 | nativeN.connect(tf.getText()); 107 | } catch(RuntimeException ex) { 108 | ex.printStackTrace(System.err); 109 | } 110 | nativeN.addNativeEventListener((key, type, evt)->{ 111 | System.out.println("> key: " + key + ", type: " + type + ", evt_msg: " + evt); 112 | }); 113 | root.getChildren().add(nativeN); 114 | }); 115 | 116 | ToolBar bar = new ToolBar(/*hidpiCB, */pbAPICB, tf, btn, delBtn, effect1Btn, effectDisableBtn, animateBtn); 117 | root.getChildren().add(bar); 118 | 119 | Scene scene = new Scene(root, 1024,768); 120 | 121 | primaryStage.setTitle("NativeFX Demo Client (running on JFX " + System.getProperty("javafx.version") + ")"); 122 | primaryStage.setScene(scene); 123 | primaryStage.setOnCloseRequest((value)->System.exit(0)); 124 | primaryStage.show(); 125 | } 126 | 127 | public static void main(String[] args) { 128 | launch(args); 129 | } 130 | 131 | } 132 | 133 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/AnimationFX.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.Animation; 4 | import javafx.animation.Timeline; 5 | import javafx.event.ActionEvent; 6 | import javafx.event.EventHandler; 7 | import javafx.scene.Node; 8 | import javafx.util.Duration; 9 | 10 | 11 | /** 12 | * @author Loïc Sculier aka typhon0 13 | */ 14 | public abstract class AnimationFX { 15 | 16 | /** 17 | * Used to specify an animation that repeats indefinitely, until the 18 | * {@code stop()} method is called. 19 | */ 20 | public static final int INDEFINITE = -1; 21 | private Timeline timeline; 22 | private boolean reset; 23 | private Node node; 24 | private AnimationFX nextAnimation; 25 | private boolean hasNextAnimation; 26 | 27 | /** 28 | * Create a new animation 29 | * 30 | * @param node the node to affect 31 | */ 32 | public AnimationFX(Node node) { 33 | super(); 34 | setNode(node); 35 | 36 | } 37 | 38 | /** 39 | * Default constructor 40 | */ 41 | public AnimationFX() { 42 | hasNextAnimation = false; 43 | this.reset = false; 44 | 45 | 46 | } 47 | 48 | /** 49 | * Handle when the animation is finished 50 | * 51 | * @return 52 | */ 53 | private AnimationFX onFinished() { 54 | if (reset) { 55 | resetNode(); 56 | } 57 | if (this.nextAnimation != null) { 58 | this.nextAnimation.play(); 59 | } 60 | return this; 61 | } 62 | 63 | /** 64 | * Set the next animation to play 65 | * 66 | * @param animation 67 | * @return 68 | */ 69 | public AnimationFX playOnFinished(AnimationFX animation) { 70 | setNextAnimation(animation); 71 | return this; 72 | 73 | } 74 | 75 | /** 76 | * Function to reset the node or not when the animation is finished 77 | * 78 | * @param reset 79 | * @return 80 | */ 81 | public AnimationFX setResetOnFinished(boolean reset) { 82 | this.reset = reset; 83 | return this; 84 | } 85 | 86 | /** 87 | * Play the animation 88 | */ 89 | public void play() { 90 | timeline.play(); 91 | } 92 | 93 | /** 94 | * Stop the animation 95 | * 96 | * @return 97 | */ 98 | public AnimationFX stop() { 99 | timeline.stop(); 100 | return this; 101 | } 102 | 103 | /** 104 | * Function the reset the node to original state 105 | * 106 | * @return 107 | */ 108 | abstract AnimationFX resetNode(); 109 | 110 | /** 111 | * Function to initialize the timeline 112 | */ 113 | abstract void initTimeline(); 114 | 115 | 116 | public Timeline getTimeline() { 117 | return timeline; 118 | } 119 | 120 | public void setTimeline(Timeline timeline) { 121 | this.timeline = timeline; 122 | } 123 | 124 | public boolean isResetOnFinished() { 125 | return reset; 126 | } 127 | 128 | protected void setReset(boolean reset) { 129 | this.reset = reset; 130 | } 131 | 132 | public Node getNode() { 133 | return node; 134 | } 135 | 136 | public void setNode(Node node) { 137 | this.node = node; 138 | initTimeline(); 139 | timeline.statusProperty().addListener((observable, oldValue, newValue) -> { 140 | if (newValue.equals(Animation.Status.STOPPED)) { 141 | onFinished(); 142 | } 143 | 144 | }); 145 | } 146 | 147 | public AnimationFX getNextAnimation() { 148 | return nextAnimation; 149 | } 150 | 151 | protected void setNextAnimation(AnimationFX nextAnimation) { 152 | hasNextAnimation = true; 153 | this.nextAnimation = nextAnimation; 154 | } 155 | 156 | public boolean hasNextAnimation() { 157 | return hasNextAnimation; 158 | } 159 | 160 | protected void setHasNextAnimation(boolean hasNextAnimation) { 161 | this.hasNextAnimation = hasNextAnimation; 162 | } 163 | 164 | /** 165 | * Define the number of cycles in this animation 166 | * 167 | * @param value 168 | * @return 169 | */ 170 | public AnimationFX setCycleCount(int value) { 171 | this.timeline.setCycleCount(value); 172 | return this; 173 | } 174 | 175 | /** 176 | * Set the speed factor of the animation 177 | * 178 | * @param value 179 | * @return 180 | */ 181 | public AnimationFX setSpeed(double value) { 182 | this.timeline.setRate(value); 183 | return this; 184 | } 185 | 186 | /** 187 | * Delays the start of an animation 188 | * 189 | * @param value 190 | * @return 191 | */ 192 | public AnimationFX setDelay(Duration value) { 193 | this.timeline.setDelay(value); 194 | return this; 195 | } 196 | 197 | /** 198 | * Set event when the animation ended. 199 | * 200 | * @param value 201 | */ 202 | public final void setOnFinished(EventHandler value) { 203 | this.timeline.setOnFinished(value); 204 | } 205 | 206 | } 207 | -------------------------------------------------------------------------------- /src/main/java/animatefx/animation/Tada.java: -------------------------------------------------------------------------------- 1 | package animatefx.animation; 2 | 3 | import javafx.animation.KeyFrame; 4 | import javafx.animation.KeyValue; 5 | import javafx.animation.Timeline; 6 | import javafx.scene.Node; 7 | import javafx.scene.transform.Rotate; 8 | import javafx.util.Duration; 9 | 10 | /** 11 | * @author Loïc Sculier aka typhon0 12 | */ 13 | public class Tada extends AnimationFX { 14 | 15 | /** 16 | * Create new Swing 17 | * 18 | * @param node The node to affect 19 | */ 20 | public Tada(Node node) { 21 | super(node); 22 | } 23 | 24 | public Tada() { 25 | } 26 | 27 | @Override 28 | AnimationFX resetNode() { 29 | return this; 30 | } 31 | 32 | @Override 33 | void initTimeline() { 34 | getNode().setRotationAxis(Rotate.Z_AXIS); 35 | setTimeline(new Timeline( 36 | new KeyFrame(Duration.millis(0), 37 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 38 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 39 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE), 40 | new KeyValue(getNode().rotateProperty(), 0, AnimateFXInterpolator.EASE) 41 | 42 | ), 43 | new KeyFrame(Duration.millis(100), 44 | new KeyValue(getNode().scaleXProperty(), 0.9, AnimateFXInterpolator.EASE), 45 | new KeyValue(getNode().scaleYProperty(), 0.9, AnimateFXInterpolator.EASE), 46 | new KeyValue(getNode().scaleZProperty(), 0.9, AnimateFXInterpolator.EASE), 47 | new KeyValue(getNode().rotateProperty(), -3, AnimateFXInterpolator.EASE) 48 | ), 49 | new KeyFrame(Duration.millis(200), 50 | new KeyValue(getNode().scaleXProperty(), 0.9, AnimateFXInterpolator.EASE), 51 | new KeyValue(getNode().scaleYProperty(), 0.9, AnimateFXInterpolator.EASE), 52 | new KeyValue(getNode().scaleZProperty(), 0.9, AnimateFXInterpolator.EASE), 53 | new KeyValue(getNode().rotateProperty(), -3, AnimateFXInterpolator.EASE) 54 | ), 55 | new KeyFrame(Duration.millis(300), 56 | new KeyValue(getNode().scaleXProperty(), 1.1, AnimateFXInterpolator.EASE), 57 | new KeyValue(getNode().scaleYProperty(), 1.1, AnimateFXInterpolator.EASE), 58 | new KeyValue(getNode().scaleZProperty(), 1.1, AnimateFXInterpolator.EASE), 59 | new KeyValue(getNode().rotateProperty(), 3, AnimateFXInterpolator.EASE) 60 | ), 61 | new KeyFrame(Duration.millis(400), 62 | new KeyValue(getNode().scaleXProperty(), 1.1, AnimateFXInterpolator.EASE), 63 | new KeyValue(getNode().scaleYProperty(), 1.1, AnimateFXInterpolator.EASE), 64 | new KeyValue(getNode().scaleZProperty(), 1.1, AnimateFXInterpolator.EASE), 65 | new KeyValue(getNode().rotateProperty(), -3, AnimateFXInterpolator.EASE) 66 | ), 67 | new KeyFrame(Duration.millis(500), 68 | new KeyValue(getNode().scaleXProperty(), 1.1, AnimateFXInterpolator.EASE), 69 | new KeyValue(getNode().scaleYProperty(), 1.1, AnimateFXInterpolator.EASE), 70 | new KeyValue(getNode().scaleZProperty(), 1.1, AnimateFXInterpolator.EASE), 71 | new KeyValue(getNode().rotateProperty(), 3, AnimateFXInterpolator.EASE) 72 | ), 73 | new KeyFrame(Duration.millis(600), 74 | new KeyValue(getNode().scaleXProperty(), 1.1, AnimateFXInterpolator.EASE), 75 | new KeyValue(getNode().scaleYProperty(), 1.1, AnimateFXInterpolator.EASE), 76 | new KeyValue(getNode().scaleZProperty(), 1.1, AnimateFXInterpolator.EASE), 77 | new KeyValue(getNode().rotateProperty(), -3, AnimateFXInterpolator.EASE) 78 | ), 79 | new KeyFrame(Duration.millis(700), 80 | new KeyValue(getNode().scaleXProperty(), 1.1, AnimateFXInterpolator.EASE), 81 | new KeyValue(getNode().scaleYProperty(), 1.1, AnimateFXInterpolator.EASE), 82 | new KeyValue(getNode().scaleZProperty(), 1.1, AnimateFXInterpolator.EASE), 83 | new KeyValue(getNode().rotateProperty(), 3, AnimateFXInterpolator.EASE) 84 | ), 85 | new KeyFrame(Duration.millis(800), 86 | new KeyValue(getNode().scaleXProperty(), 1.1, AnimateFXInterpolator.EASE), 87 | new KeyValue(getNode().scaleYProperty(), 1.1, AnimateFXInterpolator.EASE), 88 | new KeyValue(getNode().scaleZProperty(), 1.1, AnimateFXInterpolator.EASE), 89 | new KeyValue(getNode().rotateProperty(), -3, AnimateFXInterpolator.EASE) 90 | ), 91 | new KeyFrame(Duration.millis(900), 92 | new KeyValue(getNode().scaleXProperty(), 1.1, AnimateFXInterpolator.EASE), 93 | new KeyValue(getNode().scaleYProperty(), 1.1, AnimateFXInterpolator.EASE), 94 | new KeyValue(getNode().scaleZProperty(), 1.1, AnimateFXInterpolator.EASE), 95 | new KeyValue(getNode().rotateProperty(), 3, AnimateFXInterpolator.EASE) 96 | ), 97 | new KeyFrame(Duration.millis(1000), 98 | new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), 99 | new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), 100 | new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE), 101 | new KeyValue(getNode().rotateProperty(), 0, AnimateFXInterpolator.EASE) 102 | ) 103 | )); 104 | } 105 | } 106 | 107 | --------------------------------------------------------------------------------