Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added blend mode examples #78

Merged
merged 1 commit into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Example-iOS/Assets/blendmodes.riv
Binary file not shown.
8 changes: 8 additions & 0 deletions Example-iOS/RiveExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
042C88EA2644447500E7DBB2 /* skills.riv in Resources */ = {isa = PBXBuildFile; fileRef = 042C88D82644447500E7DBB2 /* skills.riv */; };
042C88EB2644447500E7DBB2 /* clipping.riv in Resources */ = {isa = PBXBuildFile; fileRef = 042C88D92644447500E7DBB2 /* clipping.riv */; };
042C88EC2644447500E7DBB2 /* vader.riv in Resources */ = {isa = PBXBuildFile; fileRef = 042C88DA2644447500E7DBB2 /* vader.riv */; };
046AFA712673AF04004ED497 /* blendmodes.riv in Resources */ = {isa = PBXBuildFile; fileRef = 046AFA6E2673AF04004ED497 /* blendmodes.riv */; };
046AFA732673B00B004ED497 /* BlendModes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 046AFA722673B00B004ED497 /* BlendModes.swift */; };
04A8F6C526454711002C909A /* LoopMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A8F6C426454711002C909A /* LoopMode.swift */; };
04BE5438264D604500427B39 /* iosPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04BE5437264D604500427B39 /* iosPlayer.swift */; };
04C4C83E2646FE410047E614 /* StateMachine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C4C83D2646FE410047E614 /* StateMachine.swift */; };
Expand Down Expand Up @@ -112,6 +114,8 @@
042C88D82644447500E7DBB2 /* skills.riv */ = {isa = PBXFileReference; lastKnownFileType = file; path = skills.riv; sourceTree = "<group>"; };
042C88D92644447500E7DBB2 /* clipping.riv */ = {isa = PBXFileReference; lastKnownFileType = file; path = clipping.riv; sourceTree = "<group>"; };
042C88DA2644447500E7DBB2 /* vader.riv */ = {isa = PBXFileReference; lastKnownFileType = file; path = vader.riv; sourceTree = "<group>"; };
046AFA6E2673AF04004ED497 /* blendmodes.riv */ = {isa = PBXFileReference; lastKnownFileType = file; path = blendmodes.riv; sourceTree = "<group>"; };
046AFA722673B00B004ED497 /* BlendModes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlendModes.swift; sourceTree = "<group>"; };
04A8F6AB26452A91002C909A /* RiveRuntime.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RiveRuntime.xcodeproj; path = ../RiveRuntime.xcodeproj; sourceTree = "<group>"; };
04A8F6C426454711002C909A /* LoopMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoopMode.swift; sourceTree = "<group>"; };
04BE5437264D604500427B39 /* iosPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosPlayer.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -162,6 +166,7 @@
04A8F6C426454711002C909A /* LoopMode.swift */,
04C4C83D2646FE410047E614 /* StateMachine.swift */,
04BE5437264D604500427B39 /* iosPlayer.swift */,
046AFA722673B00B004ED497 /* BlendModes.swift */,
);
path = UIkit;
sourceTree = "<group>";
Expand Down Expand Up @@ -210,6 +215,7 @@
042C88DA2644447500E7DBB2 /* vader.riv */,
042C88C92644447400E7DBB2 /* wacky.riv */,
C9BD3925263B5FC700696C37 /* truck_v7.riv */,
046AFA6E2673AF04004ED497 /* blendmodes.riv */,
);
path = Assets;
sourceTree = "<group>";
Expand Down Expand Up @@ -416,6 +422,7 @@
042C88DD2644447500E7DBB2 /* ui_swipe_left_to_delete.riv in Resources */,
042C88E52644447500E7DBB2 /* explorer.riv in Resources */,
042C88E22644447500E7DBB2 /* f22.riv in Resources */,
046AFA712673AF04004ED497 /* blendmodes.riv in Resources */,
042C88EC2644447500E7DBB2 /* vader.riv in Resources */,
C9C73E9E24FC471E00EF9516 /* Assets.xcassets in Resources */,
C9D3DE68264F49F4001BA265 /* life_bar.riv in Resources */,
Expand Down Expand Up @@ -447,6 +454,7 @@
C9A84F5E2644A75A0014D8E0 /* ExamplesViewController.swift in Sources */,
042C888C2643EEE300E7DBB2 /* Layout.swift in Sources */,
C9A84F602644AB6B0014D8E0 /* RiveExplorerBridge.swift in Sources */,
046AFA732673B00B004ED497 /* BlendModes.swift in Sources */,
C9D3DE60264F3B84001BA265 /* RiveProgressBarBridge.swift in Sources */,
042C88882643DB7100E7DBB2 /* SimpleAnimation.swift in Sources */,
C9E0409D264DEAA2009ABC7C /* RiveButton.swift in Sources */,
Expand Down
31 changes: 27 additions & 4 deletions Example-iOS/Source/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="wRo-9V-rXR">
<rect key="frame" x="0.0" y="88" width="414" height="281"/>
<rect key="frame" x="0.0" y="88" width="414" height="311"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="UIKit examples" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="C8u-cc-gX1">
<rect key="frame" x="0.0" y="0.0" width="414" height="20.5"/>
Expand Down Expand Up @@ -68,21 +68,28 @@
<segue destination="bLr-Sd-R4P" kind="show" id="cqv-jB-x3e"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PZ2-v5-w29">
<rect key="frame" x="0.0" y="200.5" width="414" height="30"/>
<state key="normal" title="Blend Modes"/>
<connections>
<segue destination="6Y6-o9-aZy" kind="show" id="sFN-gS-xr4"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SwiftUI examples" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wyj-7w-GPq">
<rect key="frame" x="0.0" y="200.5" width="414" height="20.5"/>
<rect key="frame" x="0.0" y="230.5" width="414" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jrC-Ng-Q2K">
<rect key="frame" x="0.0" y="221" width="414" height="30"/>
<rect key="frame" x="0.0" y="251" width="414" height="30"/>
<state key="normal" title="Rive Explorer"/>
<connections>
<segue destination="w39-2n-FCH" kind="presentation" destinationCreationSelector="hostingAction:" id="SeF-el-OxU"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Y5d-hg-cnK">
<rect key="frame" x="0.0" y="251" width="414" height="30"/>
<rect key="frame" x="0.0" y="281" width="414" height="30"/>
<state key="normal" title="SwiftUI Components"/>
<connections>
<segue destination="yNC-ze-bA4" kind="presentation" destinationCreationSelector="hostingActionStateMachine:" id="9dn-S5-TjE"/>
Expand Down Expand Up @@ -299,6 +306,22 @@
</objects>
<point key="canvasLocation" x="2741" y="-692"/>
</scene>
<!--Blend Modes-->
<scene sceneID="JXR-CF-wxg">
<objects>
<viewController id="6Y6-o9-aZy" customClass="BlendModeViewController" customModule="RiveExample" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="nG9-ag-3SU">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="m6u-Ig-qqu"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<navigationItem key="navigationItem" title="Blend Modes" id="DFg-Gs-kEt"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="0JN-k1-xkH" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-587" y="1130"/>
</scene>
<!--Loop Mode-->
<scene sceneID="iqU-00-Krb">
<objects>
Expand Down
32 changes: 32 additions & 0 deletions Example-iOS/Source/UIkit/BlendModes.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// BlendModes.swift
// RiveExample
//
// Created by Maxwell Talbot on 11/06/2021.
// Copyright © 2021 Rive. All rights reserved.
//

import UIKit
import RiveRuntime

class BlendModeViewController: UIViewController {
let resourceName = "blendmodes"

override public func loadView() {
super.loadView()

let view = RiveView()
view.fit = Fit.fitContain
guard let riveFile = RiveFile(resource: resourceName) else {
fatalError("Failed to load RiveFile")
}

view.configure(riveFile)
// self.view.addSubview(view)
self.view = view
}

override public func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
}
}
2 changes: 1 addition & 1 deletion submodules/rive-cpp