Skip to content

Commit 917ba12

Browse files
committed
test: Add background color change button.
1 parent 125fb6c commit 917ba12

File tree

2 files changed

+122
-10
lines changed

2 files changed

+122
-10
lines changed

SVGAPlayer/Base.lproj/Main.storyboard

Lines changed: 111 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,117 @@
2323
<subviews>
2424
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cmN-DO-oLC" customClass="SVGAPlayer">
2525
<rect key="frame" x="16" y="162" width="343" height="343"/>
26-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
26+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
2727
<constraints>
2828
<constraint firstAttribute="width" secondItem="cmN-DO-oLC" secondAttribute="height" multiplier="1:1" id="xm5-jB-e5a"/>
2929
</constraints>
3030
</view>
31+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wYi-Zk-AVg">
32+
<rect key="frame" x="30" y="587" width="315" height="80"/>
33+
<subviews>
34+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nzQ-nh-YFU">
35+
<rect key="frame" x="135.5" y="18" width="44" height="44"/>
36+
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
37+
<constraints>
38+
<constraint firstAttribute="width" constant="44" id="BBw-Gf-lHK"/>
39+
<constraint firstAttribute="height" constant="44" id="PZv-dO-Dxw"/>
40+
</constraints>
41+
<userDefinedRuntimeAttributes>
42+
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
43+
<integer key="value" value="6"/>
44+
</userDefinedRuntimeAttribute>
45+
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
46+
</userDefinedRuntimeAttributes>
47+
<connections>
48+
<action selector="onChangeColor:" destination="BYZ-38-t0r" eventType="touchUpInside" id="qR9-fm-dml"/>
49+
</connections>
50+
</button>
51+
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1KI-hV-KzV">
52+
<rect key="frame" x="79.5" y="18" width="44" height="44"/>
53+
<color key="backgroundColor" red="0.0" green="0.59215686274509804" blue="0.84313725490196079" alpha="1" colorSpace="calibratedRGB"/>
54+
<constraints>
55+
<constraint firstAttribute="height" constant="44" id="P2X-tz-zcv"/>
56+
<constraint firstAttribute="width" constant="44" id="TwF-QM-bTJ"/>
57+
</constraints>
58+
<userDefinedRuntimeAttributes>
59+
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
60+
<integer key="value" value="6"/>
61+
</userDefinedRuntimeAttribute>
62+
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
63+
</userDefinedRuntimeAttributes>
64+
<connections>
65+
<action selector="onChangeColor:" destination="BYZ-38-t0r" eventType="touchUpInside" id="bz7-1Y-Odw"/>
66+
</connections>
67+
</button>
68+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZFx-1M-QhD">
69+
<rect key="frame" x="23.5" y="18" width="44" height="44"/>
70+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
71+
<constraints>
72+
<constraint firstAttribute="height" constant="44" id="Ozd-yt-2wZ"/>
73+
<constraint firstAttribute="width" constant="44" id="eOU-Cz-Va3"/>
74+
</constraints>
75+
<userDefinedRuntimeAttributes>
76+
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
77+
<integer key="value" value="6"/>
78+
</userDefinedRuntimeAttribute>
79+
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
80+
</userDefinedRuntimeAttributes>
81+
<connections>
82+
<action selector="onChangeColor:" destination="BYZ-38-t0r" eventType="touchUpInside" id="L4f-gv-JP2"/>
83+
</connections>
84+
</button>
85+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9P0-Rv-Pwe">
86+
<rect key="frame" x="247.5" y="18" width="44" height="44"/>
87+
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
88+
<constraints>
89+
<constraint firstAttribute="height" constant="44" id="ZTT-TU-aMl"/>
90+
<constraint firstAttribute="width" constant="44" id="wtj-BS-0wu"/>
91+
</constraints>
92+
<userDefinedRuntimeAttributes>
93+
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
94+
<integer key="value" value="6"/>
95+
</userDefinedRuntimeAttribute>
96+
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
97+
</userDefinedRuntimeAttributes>
98+
<connections>
99+
<action selector="onChangeColor:" destination="BYZ-38-t0r" eventType="touchUpInside" id="UeC-V2-v5z"/>
100+
</connections>
101+
</button>
102+
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="V7z-xZ-hZc">
103+
<rect key="frame" x="191.5" y="18" width="44" height="44"/>
104+
<color key="backgroundColor" red="0.0078431372549019607" green="0.80000000000000004" blue="0.46274509803921571" alpha="1" colorSpace="calibratedRGB"/>
105+
<constraints>
106+
<constraint firstAttribute="width" constant="44" id="bbS-rX-Yel"/>
107+
<constraint firstAttribute="height" constant="44" id="ixM-sM-yua"/>
108+
</constraints>
109+
<userDefinedRuntimeAttributes>
110+
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
111+
<integer key="value" value="6"/>
112+
</userDefinedRuntimeAttribute>
113+
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
114+
</userDefinedRuntimeAttributes>
115+
<connections>
116+
<action selector="onChangeColor:" destination="BYZ-38-t0r" eventType="touchUpInside" id="6ER-sX-gVb"/>
117+
</connections>
118+
</button>
119+
</subviews>
120+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
121+
<constraints>
122+
<constraint firstItem="1KI-hV-KzV" firstAttribute="centerY" secondItem="wYi-Zk-AVg" secondAttribute="centerY" id="4yE-m6-GTl"/>
123+
<constraint firstItem="ZFx-1M-QhD" firstAttribute="centerX" secondItem="wYi-Zk-AVg" secondAttribute="centerX" multiplier="0.29" id="73h-vL-GYo"/>
124+
<constraint firstItem="9P0-Rv-Pwe" firstAttribute="centerY" secondItem="wYi-Zk-AVg" secondAttribute="centerY" id="9Vu-MU-riY"/>
125+
<constraint firstAttribute="height" constant="80" id="GB4-Jm-gUd"/>
126+
<constraint firstItem="V7z-xZ-hZc" firstAttribute="centerX" secondItem="wYi-Zk-AVg" secondAttribute="centerX" multiplier="1.35" id="Gm0-rp-tEs"/>
127+
<constraint firstItem="V7z-xZ-hZc" firstAttribute="centerY" secondItem="wYi-Zk-AVg" secondAttribute="centerY" id="TEd-cI-bF0"/>
128+
<constraint firstItem="ZFx-1M-QhD" firstAttribute="centerY" secondItem="wYi-Zk-AVg" secondAttribute="centerY" id="dg1-pi-u5L"/>
129+
<constraint firstItem="1KI-hV-KzV" firstAttribute="centerX" secondItem="wYi-Zk-AVg" secondAttribute="centerX" multiplier="0.65" id="gWN-yB-hcj"/>
130+
<constraint firstItem="nzQ-nh-YFU" firstAttribute="centerX" secondItem="wYi-Zk-AVg" secondAttribute="centerX" id="hxT-ei-gFa"/>
131+
<constraint firstItem="nzQ-nh-YFU" firstAttribute="centerY" secondItem="wYi-Zk-AVg" secondAttribute="centerY" id="pCt-mM-cFi"/>
132+
<constraint firstItem="9P0-Rv-Pwe" firstAttribute="centerX" secondItem="wYi-Zk-AVg" secondAttribute="centerX" multiplier="1.71" id="r4N-pw-XTz"/>
133+
</constraints>
134+
</view>
31135
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="iu9-fO-pPv">
32-
<rect key="frame" x="24" y="617" width="327" height="31"/>
136+
<rect key="frame" x="24" y="549" width="327" height="31"/>
33137
<constraints>
34138
<constraint firstAttribute="height" constant="30" id="0iR-Ol-uxF"/>
35139
</constraints>
@@ -38,15 +142,18 @@
38142
</connections>
39143
</slider>
40144
</subviews>
41-
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
145+
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
42146
<constraints>
43-
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="iu9-fO-pPv" secondAttribute="bottom" constant="20" id="CRZ-6U-acj"/>
147+
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="wYi-Zk-AVg" secondAttribute="bottom" id="1Yo-HY-RGm"/>
148+
<constraint firstItem="wYi-Zk-AVg" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="30" id="Anv-E0-INT"/>
44149
<constraint firstItem="cmN-DO-oLC" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="HF3-PL-7Ua"/>
150+
<constraint firstAttribute="trailing" secondItem="wYi-Zk-AVg" secondAttribute="trailing" constant="30" id="RKP-BR-fhw"/>
45151
<constraint firstItem="cmN-DO-oLC" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="V4O-Ov-ZmN"/>
46152
<constraint firstItem="cmN-DO-oLC" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="aSq-Gs-nkk"/>
47153
<constraint firstItem="iu9-fO-pPv" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="10" id="bJf-cY-y2d"/>
48154
<constraint firstAttribute="trailingMargin" secondItem="iu9-fO-pPv" secondAttribute="trailing" constant="10" id="oNb-um-6Qz"/>
49155
<constraint firstAttribute="trailingMargin" secondItem="cmN-DO-oLC" secondAttribute="trailing" id="vsb-Wl-Nhq"/>
156+
<constraint firstItem="wYi-Zk-AVg" firstAttribute="top" secondItem="iu9-fO-pPv" secondAttribute="bottom" constant="8" id="wjk-LT-TP4"/>
50157
</constraints>
51158
</view>
52159
<navigationItem key="navigationItem" title="Samples" id="fYC-8C-nQt">

SVGAPlayer/ViewController.m

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,21 @@ - (IBAction)onChange:(id)sender {
5454
[self.aPlayer startAnimation];
5555
}
5656
} failureBlock:nil];
57-
// [parser parseWithNamed:@"heartbeat" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
58-
// if (videoItem != nil) {
59-
// self.aPlayer.videoItem = videoItem;
60-
// [self.aPlayer startAnimation];
61-
// }
62-
// } failureBlock:nil];
57+
// [parser parseWithNamed:@"Goddess" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
58+
// if (videoItem != nil) {
59+
// self.aPlayer.videoItem = videoItem;
60+
// [self.aPlayer startAnimation];
61+
// }
62+
// } failureBlock:nil];
6363
}
6464

6565

6666
- (IBAction)onSlide:(UISlider *)sender {
6767
[self.aPlayer stepToPercentage:sender.value andPlay:NO];
6868
}
69+
70+
- (IBAction)onChangeColor:(UIButton *)sender {
71+
self.view.backgroundColor = sender.backgroundColor;
72+
}
73+
6974
@end

0 commit comments

Comments
 (0)